FACT++  1.0
int do_update_service ( unsigned  service_id,
int *  client_ids 
)

Definition at line 1546 of file dis_old.c.

References check_client(), COMMAND, req_ent::conn_id, Debug_on, req_ent::delay_delete, serv::delay_delete, DIM_ERROR, dim_print_date_time_millis(), DIMSVCINVAL, dis_remove_service(), dll_empty(), dll_get_next(), error_handler(), execute_service(), find_client(), serv::id, id_get_ptr(), serv::name, Net_conns, NET_CONNECTION::node, release_conn(), release_request(), req_ent::req_id, req_ent::reqpp, serv::request_head, cli_ent::requestp_head, service_id, sprintf(), SRC_DIS, str, NET_CONNECTION::task, TIMED_ONLY, req_ent::to_delete, and serv::to_delete.

Referenced by dis_selective_update_service(), and dis_update_service().

1547 {
1548  register REQUEST *reqp;
1549  register SERVICE *servp;
1550  REQUEST_PTR *reqpp;
1551  CLIENT *clip;
1552  register int found = 0;
1553  int to_delete = 0, more, conn_id;
1554  char str[128];
1555  int release_request();
1556 
1557  DISABLE_AST
1558  if(!service_id)
1559  {
1560  sprintf(str, "Update Service - Invalid service id");
1562  ENABLE_AST
1563  return(found);
1564  }
1565  servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
1566  if(!servp)
1567  {
1568  ENABLE_AST
1569  return(found);
1570  }
1571  if(servp->id != (int)service_id)
1572  {
1573  ENABLE_AST
1574  return(found);
1575  }
1576  servp->delay_delete = 1;
1577  reqp = servp->request_head;
1578  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1579  (DLL *) reqp)) )
1580  {
1581 if(Debug_on)
1582 {
1584 printf("Updating %s (id = %d, ptr = %08lX) for %s@%s (req_id = %d, req_ptr = %08lX)\n",
1585  servp->name, (int)service_id, (unsigned long)servp,
1586  Net_conns[reqp->conn_id].task, Net_conns[reqp->conn_id].node, reqp->req_id, (unsigned long)reqp);
1587 }
1588  if(check_client(reqp, client_ids))
1589  reqp->delay_delete = 1;
1590  }
1591  ENABLE_AST
1592  {
1593  DISABLE_AST
1594  reqp = servp->request_head;
1595  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1596  (DLL *) reqp)) )
1597  {
1598  if(reqp->delay_delete && ((reqp->type & 0xFFF) != COMMAND))
1599  {
1600  if(check_client(reqp, client_ids))
1601  {
1602  if( (reqp->type & 0xFFF) != TIMED_ONLY )
1603  {
1604 /*
1605  DISABLE_AST
1606 */
1607  execute_service(reqp->req_id);
1608  found++;
1609  ENABLE_AST
1610  {
1611  DISABLE_AST
1612  }
1613  }
1614  }
1615  }
1616  }
1617  ENABLE_AST
1618  }
1619  {
1620  DISABLE_AST
1621  reqp = servp->request_head;
1622  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1623  (DLL *) reqp)) )
1624  {
1625  if(check_client(reqp, client_ids))
1626  {
1627  reqp->delay_delete = 0;
1628  if(reqp->to_delete)
1629  to_delete = 1;
1630  }
1631  }
1632  ENABLE_AST
1633  }
1634  if(to_delete)
1635  {
1636  DISABLE_AST
1637  do
1638  {
1639  more = 0;
1640  reqp = servp->request_head;
1641  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1642  (DLL *) reqp)) )
1643  {
1644  if(reqp->to_delete & 0x1)
1645  {
1646  more = 1;
1647  reqp->to_delete = 0;
1648  release_conn(reqp->conn_id, 1, 0);
1649  break;
1650  }
1651  else if(reqp->to_delete & 0x2)
1652  {
1653  more = 1;
1654  reqp->to_delete = 0;
1655  reqpp = reqp->reqpp;
1656  conn_id = reqp->conn_id;
1657  release_request(reqp, reqpp, 1);
1658  clip = find_client(conn_id);
1659  if(clip)
1660  {
1661  if( dll_empty((DLL *)clip->requestp_head) )
1662  {
1663  release_conn( conn_id, 0, 0);
1664  }
1665  }
1666  break;
1667  }
1668  }
1669  }while(more);
1670  ENABLE_AST
1671  }
1672  {
1673  DISABLE_AST
1674  servp->delay_delete = 0;
1675  if(servp->to_delete)
1676  {
1677  dis_remove_service(servp->id);
1678  }
1679  ENABLE_AST
1680  }
1681 
1682  return(found);
1683 }
int execute_service(int req_id)
Definition: dis_old.c:1275
unsigned service_id
Definition: db_dim_client.c:22
int to_delete
Definition: dis.c:89
char task[MAX_TASK_NAME]
Definition: dim.h:408
DllExp DIM_NOSHARE NET_CONNECTION * Net_conns
Definition: conn_handler.c:32
#define COMMAND
Definition: dim_common.h:10
char str[80]
Definition: test_client.c:7
void * id_get_ptr(int id, SRC_TYPES type)
Definition: conn_handler.c:184
int to_delete
Definition: dis.c:64
Definition: dis.c:98
char name[MAX_NAME]
Definition: dis.c:72
int release_request(REQUEST *reqp, REQUEST_PTR *reqpp, int remove)
Definition: dis_old.c:2341
char node[MAX_NODE_NAME]
Definition: dim.h:407
#define TIMED_ONLY
Definition: dim_common.h:14
static int Debug_on
Definition: dis_old.c:152
Definition: dim.h:530
int delay_delete
Definition: dis.c:88
Definition: dis.c:69
REQUEST * request_head
Definition: dis.c:86
REQUEST_PTR * requestp_head
Definition: dis.c:102
#define DIMSVCINVAL
Definition: dim_common.h:290
int dis_remove_service(unsigned service_id)
Definition: dis_old.c:1919
CLIENT * find_client(int conn_id)
Definition: dis_old.c:2148
int dll_empty(DLL *head)
Definition: dll.c:88
static void error_handler(int conn_id, int severity, int errcode, char *reason)
Definition: dis_old.c:2827
int delay_delete
Definition: dis.c:63
DLL * dll_get_next(DLL *head, DLL *item)
Definition: dll.c:66
Definition: dis.c:92
int req_id
Definition: dis.c:57
static int release_conn(int conn_id, int print_flg, int dns_flag)
Definition: dis_old.c:2374
int conn_id
Definition: dis.c:55
int check_client(REQUEST *reqp, int *client_ids)
Definition: dis_old.c:1531
Definition: dis.c:52
sprintf(name1,"NewService%d", i)
int id
Definition: dis.c:73
void dim_print_date_time_millis()
Definition: utilities.c:157

+ Here is the call graph for this function:

+ Here is the caller graph for this function: