Changeset 25872 for trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c
- Timestamp:
- Oct 18, 2009, 10:29:11 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/CheckIdleHost.c
r23330 r25872 1 1 # include "pcontrol.h" 2 2 3 // The connection to the remote host is only allow to live for MAX_CONNECT_TIME seconds. We 4 // disconnect and reconnect if a remote host has been connected for too long. This is a 5 // (temporary?) work-around for the problem that the remote pclient job tends to grow too large 6 // over time. 7 8 # define MAX_CONNECT_TIME 36000.0 9 3 10 static FILE *logfile = NULL; 11 12 /* if this host has been connected for too long, disconnect (will automatically reconnect) */ 13 int CheckResetHost (Host *host) { 14 15 struct timeval now; 16 float dtime; 17 18 /* if this host has been connected for too long, disconnect (will automatically reconnect) */ 19 gettimeofday (&now, (void *) NULL); 20 dtime = DTIME (now, host[0].connect_time); 21 if (dtime > MAX_CONNECT_TIME) { 22 if (VerboseMode()) gprint (GP_ERR, "disconnect from %s\n", host[0].hostname); 23 StopHost (host, PCONTROL_HOST_DOWN); 24 return (TRUE); 25 } 26 return FALSE; 27 } 4 28 5 29 /* the supplied host is not on a stack: it cannot be taken by the other thread */ … … 21 45 if (host[0].markoff) { 22 46 host[0].markoff = FALSE; 23 StopHost (host );47 StopHost (host, PCONTROL_HOST_OFF); 24 48 return (TRUE); 25 49 } 26 50 51 /* check if host has been connected for too long */ 52 if (CheckResetHost (host)) { 53 return (TRUE); 54 } 55 27 56 /* search the JOB_PENDING stack for an appropriate job */ 28 57 stack = GetJobStack (PCONTROL_JOB_PENDING);
Note:
See TracChangeset
for help on using the changeset viewer.
