Changeset - 262e6275036b
[Not reviewed]
default
0 3 0
Nathan Brink (binki) - 16 years ago 2009-12-12 17:45:38
ohnobinki@ohnopublishing.net
fix sendSignal() use of remoteio, config
3 files changed with 14 insertions and 6 deletions:
0 comments (0 inline, 0 general)
etc/distrenslave.conf.in
Show inline comments
 
slave
 
{
 
  username = "!username"
 
  datadir = "@LOCALSTATEDIR@/@PACKAGE@"
 
  hostname = "protofusion.org"
 
  server = "protofusion"
 
}
 

	
 
include("distrencommon.conf")
src/common/remoteio.h
Show inline comments
 
@@ -35,13 +35,15 @@ struct remoteio;
 
   @todo should this be asynchronous?
 
 */
 
int remoteio_open(struct remoteio **rem, struct remoteio_opts *opts, const char *servername);
 

	
 
/**
 
   non-blocking I/O.
 
   @return 0 on success, 1 on failure
 
   @param len must be greater than 0
 

	
 
   @return 0 on success, 1 on failure. 
 
 */
 
int remoteio_read(struct remoteio *rem, void *buf, size_t len, size_t *bytesread);
 
int remoteio_write(struct remoteio *rem, void *buf, size_t len, size_t *byteswritten);
 

	
 
/**
 
   Closes a remoteio session.
src/server/slavefuncs.c
Show inline comments
 
@@ -44,20 +44,26 @@ int sendSignal(struct remoteio *rem, int
 
  size_t written;
 
  size_t towrite;
 
  char *ssignal;
 

	
 
  _distren_asprintf(&ssignal, "%d", signal);
 
  towrite = strlen(ssignal);
 
  while( !remoteio_write(rem, ssignal, towrite, &written)
 
	 && towrite
 
	 && written)
 
  while( towrite
 
	 && !remoteio_write(rem, ssignal, towrite, &written))
 
    {
 
      printf(stderr, "Writing...");
 
      towrite -= written;
 
    }
 
  return 0;
 
  if(written)
 
    return 0;
 

	
 
  /**
 
     if remoteio_write returned 1, the connection
 
     is probably dead or there was a real error
 
   */
 
  return 1;
 
}
 
/**
 
 utility function for XPath-ish stuff:
 
 */
 
xmlNodePtr xml_quickxpath(xmlXPathContextPtr xpathctxt, xmlChar *path)
 
{
0 comments (0 inline, 0 general)