IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 18, 2009, 10:29:11 AM (17 years ago)
Author:
eugene
Message:

updated pcontrol to restart pclients that have been connected for too long

File:
1 edited

Legend:

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

    r23330 r25872  
    11# include "pcontrol.h"
    22
     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
    310static FILE *logfile = NULL;
     11
     12  /* if this host has been connected for too long, disconnect (will automatically reconnect) */
     13int 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}
    428
    529/* the supplied host is not on a stack: it cannot be taken by the other thread */
     
    2145  if (host[0].markoff) {
    2246    host[0].markoff = FALSE;
    23     StopHost (host);
     47    StopHost (host, PCONTROL_HOST_OFF);
    2448    return (TRUE);
    2549  }
    2650   
     51  /* check if host has been connected for too long */
     52  if (CheckResetHost (host)) {
     53    return (TRUE);
     54  }
     55
    2756  /* search the JOB_PENDING stack for an appropriate job */
    2857  stack = GetJobStack (PCONTROL_JOB_PENDING);
Note: See TracChangeset for help on using the changeset viewer.