FACT++  1.0
void inform_clients ( DNS_SERVICE servp)

Definition at line 984 of file dns.c.

References node::conn_id, red_node::conn_id, serv::conn_id, Curr_N_Conns, Debug, dim_print_date_time(), dll_get_next(), dll_remove(), dna_write_nowait(), Dns_conns, DNS_DIC_HEADER, DNS_DIC_PACKET::format, Memory::free(), i, Net_conns, NET_CONNECTION::node, DNS_DIC_PACKET::node_addr, DNS_CONNECTION::node_addr, serv::node_head, DNS_DIC_PACKET::node_name, DNS_CONNECTION::node_name, DNS_DIC_PACKET::pid, DNS_CONNECTION::pid, DNS_DIC_PACKET::port, DNS_CONNECTION::port, red_node::prev, DNS_DIC_PACKET::protocol, DNS_CONNECTION::protocol, release_conn(), serv::serv_def, serv::server_format, DNS_DIC_PACKET::service_def, red_node::service_id, DNS_DIC_PACKET::service_id, DNS_DIC_PACKET::size, SRC_DIC, NET_CONNECTION::task, DNS_DIC_PACKET::task_name, and DNS_CONNECTION::task_name.

Referenced by do_inform_clients(), and handle_registration().

985 {
986  RED_NODE *nodep, *prevp;
987  NODE *full_nodep;
988  DNS_DIC_PACKET packet;
989  char *ptr;
990  int i, to_release = 0;
991 
992  nodep = servp->node_head;
993  prevp = nodep;
994  while( (nodep = (RED_NODE *) dll_get_next((DLL *) servp->node_head,
995  (DLL *) prevp)) )
996  {
997  packet.service_id = htovl(nodep->service_id);
998  strcpy(packet.node_name, Dns_conns[servp->conn_id].node_name);
999  strcpy(packet.task_name, Dns_conns[servp->conn_id].task_name);
1000  for(i = 0; i < 4; i++)
1001  packet.node_addr[i] = Dns_conns[servp->conn_id].node_addr[i];
1002  packet.port = htovl(Dns_conns[servp->conn_id].port);
1003  packet.pid = htovl(Dns_conns[servp->conn_id].pid);
1004  packet.protocol = htovl(Dns_conns[servp->conn_id].protocol);
1005  packet.size = htovl(DNS_DIC_HEADER);
1006  packet.format = htovl(servp->server_format);
1007  strcpy( packet.service_def, servp->serv_def );
1008 /* Should it be dna_write_nowait? 16/9/2008 */
1009 /* moved from dna_write to dna_write_nowait in 14/10/2008 */
1010 /*
1011  dna_write_nowait(nodep->conn_id, &packet, DNS_DIC_HEADER);
1012 */
1013  if( !dna_write_nowait(nodep->conn_id, &packet, DNS_DIC_HEADER) )
1014  {
1016  printf(" Inform Client: Couldn't write, releasing Conn %3d : Client %s@%s\n",nodep->conn_id,
1017  Net_conns[nodep->conn_id].task,
1018  Net_conns[nodep->conn_id].node);
1019  fflush(stdout);
1020  to_release = nodep->conn_id;
1021 /*
1022 release_conn(nodep->conn_id);
1023 */
1024  }
1025 /*
1026  if(dna_write_nowait(nodep->conn_id, &packet, DNS_DIC_HEADER))
1027  {
1028 */
1029  dll_remove( (DLL *) nodep );
1030  ptr = (char *)nodep - (2 * sizeof(void *));
1031  full_nodep = (NODE *)ptr;
1032  dll_remove( (DLL *) full_nodep );
1033  nodep = nodep->prev;
1034  free( full_nodep );
1035  prevp = nodep;
1036 /*
1037  }
1038 */
1039  }
1040  if(to_release)
1041  release_conn(to_release);
1042 }
char node_name[MAX_NODE_NAME]
Definition: dim.h:431
Definition: dns.c:26
static void release_conn(int conn_id)
Definition: dns.c:1077
int protocol
Definition: dim.h:438
char node_addr[4]
Definition: dim.h:433
struct red_node * prev
Definition: dns.c:38
char task[MAX_TASK_NAME]
Definition: dim.h:408
DllExp DIM_NOSHARE DNS_CONNECTION * Dns_conns
Definition: conn_handler.c:29
int i
Definition: db_dim_client.c:21
DllExp DIM_NOSHARE NET_CONNECTION * Net_conns
Definition: conn_handler.c:32
char node_addr[4]
Definition: dim.h:312
char service_def[MAX_NAME]
Definition: dim.h:309
char node[MAX_NODE_NAME]
Definition: dim.h:407
char node_name[MAX_NODE_NAME]
Definition: dim.h:310
void dll_remove(DLL *item)
Definition: dll.c:100
int conn_id
Definition: dns.c:52
int protocol
Definition: dim.h:315
#define DNS_DIC_HEADER
Definition: dim.h:319
int format
Definition: dim.h:316
char task_name[MAX_TASK_NAME-4]
Definition: dim.h:432
int pid
Definition: dim.h:434
RED_NODE * node_head
Definition: dns.c:55
Definition: dim.h:530
int server_format
Definition: dns.c:53
char serv_def[MAX_NAME]
Definition: dns.c:50
int dna_write_nowait(int conn_id, void *buffer, int size)
Definition: dna.c:412
int port
Definition: dim.h:435
void free(void *mem)
DLL * dll_get_next(DLL *head, DLL *item)
Definition: dll.c:66
void dim_print_date_time()
Definition: utilities.c:134
int service_id
Definition: dns.c:40
int service_id
Definition: dim.h:308
char task_name[MAX_TASK_NAME-4]
Definition: dim.h:311
int pid
Definition: dim.h:313
int conn_id
Definition: dns.c:39
int port
Definition: dim.h:314
int size
Definition: dim.h:307
Definition: dns.c:36

+ Here is the call graph for this function:

+ Here is the caller graph for this function: