FACT++  1.0
static int ins_pend_conn ( char *  node,
char *  task,
int  port,
SRC_TYPES  src_type,
int  type,
time_t  last_used 
)
static

Definition at line 620 of file dna.c.

References i, PENDING_OPEN::last_used, MAX_CONNS, MAX_TMOUT_PENDING_CONNS, PENDING_OPEN::node_name, PENDING_OPEN::port, size, PENDING_OPEN::src_type, PENDING_OPEN::task_name, and time.

Referenced by dna_close(), and dna_open_client().

621 {
622  register PENDING_OPEN *pending_connp;
623  register int i, size;
624  time_t oldest;
625  int oldesti = 0;
626  extern time_t time();
627 
628  if(type == 0)
629  {
630  pending_connp = &Pending_conns[1];
631  size = MAX_CONNS;
632  oldest = 0;
633  }
634  else
635  {
636  pending_connp = &Pending_conns_tmout[1];
638  oldest = time(NULL);
639  oldesti = 1;
640  }
641 
642  for( i = 1; i < size; i++, pending_connp++ )
643  {
644  if( pending_connp->task_name[0] == '\0' )
645  {
646  strcpy(pending_connp->node_name, node);
647  strcpy(pending_connp->task_name, task);
648  pending_connp->port = port;
649  pending_connp->src_type = src_type;
650  pending_connp->last_used = last_used;
651  return(i);
652  }
653  else
654  {
655  if(pending_connp->last_used < oldest)
656  {
657  oldest = pending_connp->last_used;
658  oldesti = i;
659  }
660  }
661  }
662  if(type != 0)
663  {
664  pending_connp = &Pending_conns_tmout[oldesti];
665  strcpy(pending_connp->node_name, node);
666  strcpy(pending_connp->task_name, task);
667  pending_connp->port = port;
668  pending_connp->src_type = src_type;
669  pending_connp->last_used = last_used;
670  return(oldesti);
671  }
672  return(0);
673 }
Definition: dns.c:26
char node_name[MAX_NODE_NAME]
Definition: dna.c:29
time_t last_used
Definition: dna.c:33
int i
Definition: db_dim_client.c:21
SRC_TYPES src_type
Definition: dna.c:32
#define MAX_CONNS
Definition: dim.h:163
static PENDING_OPEN Pending_conns[MAX_CONNS]
Definition: dna.c:38
int type
int port
Definition: dna.c:31
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Definition: smartfact.txt:92
#define MAX_TMOUT_PENDING_CONNS
Definition: dna.c:37
int size
Definition: db_dim_server.c:17
static PENDING_OPEN Pending_conns_tmout[MAX_TMOUT_PENDING_CONNS]
Definition: dna.c:39
char task_name[MAX_TASK_NAME]
Definition: dna.c:30

+ Here is the caller graph for this function: