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

Definition at line 1714 of file dis.c.

References check_client(), COMMAND, req_ent::conn_id, req_ent::delay_delete, serv::delay_delete, DIM_ERROR, DIMSVCINVAL, dis_remove_service(), dll_empty(), dll_get_next(), error_handler(), execute_service(), find_client(), serv::id, id_get_ptr(), Last_n_clients, release_conn(), release_request(), req_ent::req_id, req_ent::reqpp, serv::request_head, cli_ent::requestp_head, service_id, Serving, sprintf(), SRC_DIS, str, TIMED_ONLY, req_ent::to_delete, serv::to_delete, and req_ent::type.

Referenced by dis_selective_update_service(), dis_update_service(), and Java_dim_Server_selectiveUpdateService().

1715 {
1716  register REQUEST *reqp;
1717  register SERVICE *servp;
1718  REQUEST_PTR *reqpp;
1719  CLIENT *clip;
1720  register int found = 0;
1721  int to_delete = 0, more, conn_id;
1722  char str[128];
1723  int release_request();
1724  int n_clients = 0;
1725 
1726  DISABLE_AST
1727  if(Serving == -1)
1728  {
1729  ENABLE_AST
1730  return(found);
1731  }
1732  if(!service_id)
1733  {
1734  sprintf(str, "Update Service - Invalid service id");
1735  error_handler(0, DIM_ERROR, DIMSVCINVAL, str, -1);
1736  ENABLE_AST
1737  return(found);
1738  }
1739  servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
1740  if(!servp)
1741  {
1742  ENABLE_AST
1743  return(found);
1744  }
1745  if(servp->id != (int)service_id)
1746  {
1747  ENABLE_AST
1748  return(found);
1749  }
1750  servp->delay_delete = 1;
1751  reqp = servp->request_head;
1752  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1753  (DLL *) reqp)) )
1754  {
1755 /*
1756 if(Debug_on)
1757 {
1758 dim_print_date_time();
1759 printf("Updating %s (id = %d, ptr = %08lX) for %s@%s (req_id = %d, req_ptr = %08lX)\n",
1760  servp->name, (int)service_id, (unsigned dim_long)servp,
1761  Net_conns[reqp->conn_id].task, Net_conns[reqp->conn_id].node, reqp->req_id, (unsigned dim_long)reqp);
1762 }
1763 */
1764  if(check_client(reqp, client_ids))
1765  {
1766  reqp->delay_delete = 1;
1767  n_clients++;
1768  }
1769  }
1770  ENABLE_AST
1771  {
1772  DISABLE_AST
1773  Last_n_clients = n_clients;
1774  reqp = servp->request_head;
1775  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1776  (DLL *) reqp)) )
1777  {
1778  if(reqp->delay_delete && ((reqp->type & 0xFFF) != COMMAND))
1779  {
1780  if(check_client(reqp, client_ids))
1781  {
1782  if( (reqp->type & 0xFFF) != TIMED_ONLY )
1783  {
1784 /*
1785  DISABLE_AST
1786 */
1787  execute_service(reqp->req_id);
1788  found++;
1789  ENABLE_AST
1790  {
1791  DISABLE_AST
1792  }
1793  }
1794  }
1795  }
1796  }
1797  ENABLE_AST
1798  }
1799  {
1800  DISABLE_AST
1801  reqp = servp->request_head;
1802  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1803  (DLL *) reqp)) )
1804  {
1805  if(check_client(reqp, client_ids))
1806  {
1807  reqp->delay_delete = 0;
1808  if(reqp->to_delete)
1809  to_delete = 1;
1810  }
1811  }
1812  ENABLE_AST
1813  }
1814  if(to_delete)
1815  {
1816  DISABLE_AST
1817  do
1818  {
1819  more = 0;
1820  reqp = servp->request_head;
1821  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1822  (DLL *) reqp)) )
1823  {
1824  if(reqp->to_delete & 0x1)
1825  {
1826  more = 1;
1827  reqp->to_delete = 0;
1828  release_conn(reqp->conn_id, 1, 0);
1829  break;
1830  }
1831  else if(reqp->to_delete & 0x2)
1832  {
1833  more = 1;
1834  reqp->to_delete = 0;
1835  reqpp = reqp->reqpp;
1836  conn_id = reqp->conn_id;
1837  release_request(reqp, reqpp, 1);
1838  clip = find_client(conn_id);
1839  if(clip)
1840  {
1841  if( dll_empty((DLL *)clip->requestp_head) )
1842  {
1843  release_conn( conn_id, 0, 0);
1844  }
1845  }
1846  break;
1847  }
1848  }
1849  }while(more);
1850  ENABLE_AST
1851  }
1852  {
1853  DISABLE_AST
1854  servp->delay_delete = 0;
1855  if(servp->to_delete)
1856  {
1857  dis_remove_service(servp->id);
1858  }
1859  ENABLE_AST
1860  }
1861 
1862  return(found);
1863 }
static void error_handler(int conn_id, int severity, int errcode, char *reason, int exit)
Definition: dis.c:3199
unsigned service_id
Definition: db_dim_client.c:22
int to_delete
Definition: dis.c:89
#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
int execute_service(int req_id)
Definition: dis.c:1397
Definition: dis.c:98
static int release_conn(int conn_id, int print_flg, int dns_flag)
Definition: dis.c:2684
CLIENT * find_client(int conn_id)
Definition: dis.c:2455
#define TIMED_ONLY
Definition: dim_common.h:14
int dis_remove_service(unsigned service_id)
Definition: dis.c:2112
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 dll_empty(DLL *head)
Definition: dll.c:88
int check_client(REQUEST *reqp, int *client_ids)
Definition: dis.c:1699
int release_request(REQUEST *reqp, REQUEST_PTR *reqpp, int remove)
Definition: dis.c:2650
int type
Definition: dis.c:58
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 Serving
Definition: dis.c:124
Definition: dis.c:52
sprintf(name1,"NewService%d", i)
static int Last_n_clients
Definition: dis.c:150
int id
Definition: dis.c:73

+ Here is the call graph for this function:

+ Here is the caller graph for this function: