IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17474


Ignore:
Timestamp:
Apr 21, 2008, 11:56:53 PM (18 years ago)
Author:
eugene
Message:

incomplete message means client is hung

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/PclientCommand.c

    r16590 r17474  
    11# include "pcontrol.h"
    2 # define PCLIENT_TIMEOUT 5000
     2# define PCLIENT_TIMEOUT 20000
    33
    44int PclientCommand (Host *host, char *command, char *response, IOBuffer *buffer) {
     
    1414  ASSERT (response != NULL, "response missing");
    1515
    16   /* avoid blocking on read, test every 100 usec, up to 50 msec */
     16  /* avoid blocking on read, test every 100 usec, up to 2.0 sec */
    1717  request.tv_sec = 0;
    1818  request.tv_nsec = 100000;
     
    3636  line = NULL;
    3737  status = -1;
     38
    3839  for (i = 0; (i < PCLIENT_TIMEOUT) && (status != 0) && (line == NULL); i++) {
    3940    status = ReadtoIOBuffer (buffer, host[0].stdout_fd);
     
    4647  }
    4748  if (status == -1) return (PCLIENT_HUNG);
    48   /* gprint (GP_ERR, "buffer.buffer: %s\n", buffer[0].buffer); */
     49  if (line == NULL) return (PCLIENT_HUNG);
     50
     51  // fprintf (stderr, "buffer.buffer: %s\n", buffer[0].buffer);
    4952  return (PCLIENT_GOOD);
    5053}
    5154
    5255/* memstr returns a view, not an allocated string : don't free */
     56/* ReadtoIOBuffer returns :
     57    0 - pipe closed
     58   -1 - no more data in pipe, data not ready
     59   -2 - serious error reading from pipe
     60   >0 - data read from pipe
     61*/
Note: See TracChangeset for help on using the changeset viewer.