FACT++  1.0
void service_tmout ( int  serv_id)

Definition at line 518 of file dic.c.

References COMMAND, dic_serv::conn_id, Curr_conn_id, dic_release_service(), dim_print_date_time(), dic_serv::fill_address, dic_serv::fill_size, id_get_ptr(), ONCE_ONLY, dic_serv::pending, dic_serv::serv_address, dic_serv::serv_id, dic_serv::serv_name, dic_serv::serv_size, SRC_DIC, dic_serv::tag, dic_serv::tmout_done, dic_serv::type, dic_serv::user_routine, WAITING_CMND_ANSWER, WAITING_DNS_ANSWER, and WAITING_DNS_UP.

Referenced by dic_close_dns(), handle_dns_info(), recv_dns_dic_rout(), recv_rout(), and request_dns_info().

519 {
520  int once_only, size = 0;
521  register DIC_SERVICE *servp;
522 
523 /*
524 dim_print_date_time();
525 printf("In service tmout\n");
526 */
528  if(!servp)
529  return;
530  if(servp->tmout_done)
531  return;
532 /*
533 dim_print_date_time();
534 printf("In service tmout %s\n", servp->serv_name);
535 */
536  servp->tmout_done = 1;
537  Curr_conn_id = servp->conn_id;
538 /*
539  if( servp->type == UPDATE )
540  return;
541 */
542  if( servp->type == COMMAND )
543  {
544  if( servp->user_routine )
545  {
546  if(servp->pending == WAITING_CMND_ANSWER)
547  size = 1;
548  else
549  size = 0;
550  (servp->user_routine)( &servp->tag, &size );
551  }
552  else
553  {
554  if((servp->pending == WAITING_DNS_UP) || (servp->pending == WAITING_DNS_ANSWER))
555  {
557  printf(" Client Sending Command: Command %s discarded, no DNS answer\n", servp->serv_name);
558  fflush(stdout);
559  }
560 /*
561  else if(servp->pending == WAITING_SERVER_UP)
562  {
563  }
564 */
565  }
566  dic_release_service( (unsigned)servp->serv_id );
567  Curr_conn_id = 0;
568  return;
569  }
570  once_only = 0;
571  if(servp->type == ONCE_ONLY)
572  once_only = 1;
573 /*
574  if( servp->fill_address )
575 */
576  if( servp->fill_size >= 0 )
577  {
578  size = servp->fill_size;
579  if( servp->serv_address )
580  {
581  if( size > servp->serv_size )
582  size = servp->serv_size;
583  memcpy(servp->serv_address, servp->fill_address, (size_t)size);
584  if( servp->user_routine )
585  (servp->user_routine)( &servp->tag, servp->serv_address, &size);
586  }
587  else
588  {
589  if( servp->user_routine )
590  (servp->user_routine)( &servp->tag, servp->fill_address, &size);
591  }
592  }
593  if( once_only )
594  {
595  dic_release_service( (unsigned)servp->serv_id );
596  }
597  Curr_conn_id = 0;
598 }
int * fill_address
Definition: dim.h:470
int tmout_done
Definition: dim.h:477
#define COMMAND
Definition: dim_common.h:10
void * id_get_ptr(int id, SRC_TYPES type)
Definition: conn_handler.c:184
PENDING_STATES pending
Definition: dim.h:476
void(* user_routine)()
Definition: dim.h:472
dim_long tag
Definition: dim.h:473
int * serv_address
Definition: dim.h:468
int type
Definition: dim.h:465
int conn_id
Definition: dim.h:475
Definition: dim.h:457
static int Curr_conn_id
Definition: dic.c:54
int serv_id
Definition: demo_server.c:5
int serv_id
Definition: dim.h:461
int size
Definition: db_dim_server.c:17
char serv_name[MAX_NAME]
Definition: dim.h:460
void dim_print_date_time()
Definition: utilities.c:134
int fill_size
Definition: dim.h:471
#define ONCE_ONLY
Definition: dim_common.h:7
int serv_size
Definition: dim.h:469
void dic_release_service(unsigned service_id)
Definition: dic.c:1025

+ Here is the call graph for this function:

+ Here is the caller graph for this function: