FACT++  1.0
void kill_servers ( int *  tag,
int *  code,
int *  size 
)

Definition at line 1568 of file dns.c.

References Curr_N_Conns, dim_print_date_time(), dna_write_nowait(), Dns_conns, DNS_DIS_EXIT, DNS_DIS_HEADER, DNS_DIS_SOFT_EXIT, i, release_conn(), size, DNS_DIS_PACKET::size, SRC_DIS, type, and DNS_DIS_PACKET::type.

Referenced by main().

1569 {
1570  int i;
1571  DNS_DIS_PACKET dis_packet;
1572  int soft_code = 0, soft_size = 0;
1573  int type;
1574 
1575  if(tag){}
1576  if(size)
1577  {
1578  soft_size = *size;
1579  if(code)
1580  {
1581  soft_code = *code;
1582  }
1583  }
1584  for(i = 0; i< Curr_N_Conns; i++)
1585  {
1586  if(Dns_conns[i].src_type == SRC_DIS)
1587  {
1588  if(!strcmp(Dns_conns[i].task_name,"DIS_DNS"))
1589  continue;
1590  fflush(stdout);
1591  type = DNS_DIS_EXIT;
1592  if(soft_size)
1593  {
1594  type = DNS_DIS_SOFT_EXIT;
1595  type |= (soft_code << (int)16) & (int)0xFFFF0000;
1597  printf(" Killing server %s@%s with exit code %d\n",
1598  Dns_conns[i].task_name, Dns_conns[i].node_name, soft_code);
1599  }
1600  else
1601  {
1603  printf(" Killing server %s@%s\n",
1604  Dns_conns[i].task_name, Dns_conns[i].node_name);
1605  }
1606  dis_packet.type = htovl(type);
1607  dis_packet.size = htovl(DNS_DIS_HEADER);
1608  if( !dna_write_nowait(i, &dis_packet, DNS_DIS_HEADER) )
1609  {
1611  printf(" Kill Server: Couldn't write, releasing %d\n",i);
1612  fflush(stdout);
1613  release_conn(i);
1614  }
1615  }
1616  }
1617 }
static void release_conn(int conn_id)
Definition: dns.c:1077
DllExp DIM_NOSHARE int Curr_N_Conns
Definition: conn_handler.c:33
DllExp DIM_NOSHARE DNS_CONNECTION * Dns_conns
Definition: conn_handler.c:29
int i
Definition: db_dim_client.c:21
int type
Definition: dim.h:288
#define DNS_DIS_HEADER
Definition: dim.h:291
int type
int size
Definition: dim.h:287
int dna_write_nowait(int conn_id, void *buffer, int size)
Definition: dna.c:412
int size
Definition: db_dim_server.c:17
void dim_print_date_time()
Definition: utilities.c:134

+ Here is the call graph for this function:

+ Here is the caller graph for this function: