FACT++  1.0
int dis_remove_service ( unsigned  service_id)

Definition at line 1919 of file dis_old.c.

References serv::delay_delete, DIM_ERROR, DIMSVCINVAL, dis_dns_ent::dis_client_id, dis_hash_service_remove(), dis_dns_ent::dis_n_services, dis_dns_ent::dis_service_id, dll_get_next(), serv::dnsp, do_dis_stop_serving_dns(), error_handler(), Memory::free(), serv::id, id_free(), id_get_ptr(), req_ent::prev, release_request(), remove_service(), req_ent::req_id, req_ent::reqpp, serv::request_head, service_id, dis_dns_ent::serving, sprintf(), SRC_DIS, str, serv::to_delete, and unregister_service().

Referenced by dis_hash_print(), dis_stop_serving(), do_dis_add_service(), do_dis_stop_serving_dns(), and do_update_service().

1920 {
1921  register REQUEST *reqp, *auxp;
1922  register SERVICE *servp;
1923  REQUEST_PTR *reqpp;
1924  int found = 0;
1925  char str[128];
1926  int release_request();
1928  DIS_DNS_CONN *dnsp;
1929  int n_services;
1931 
1932  DISABLE_AST
1933  if(!service_id)
1934  {
1935  sprintf(str,"Remove Service - Invalid service id");
1937  ENABLE_AST
1938  return(found);
1939  }
1940  servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
1941  if(!servp)
1942  {
1943  ENABLE_AST
1944  return(found);
1945  }
1946  if(servp->id != (int)service_id)
1947  {
1948  ENABLE_AST
1949  return(found);
1950  }
1951  if(servp->delay_delete)
1952  {
1953  servp->to_delete = 1;
1954  ENABLE_AST
1955  return(found);
1956  }
1957  /* remove from name server */
1958 
1959  dnsp = servp->dnsp;
1960  unregister_service(dnsp, servp);
1961  /* Release client requests and remove from actual clients */
1962  reqp = servp->request_head;
1963  while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
1964  (DLL *) reqp)) )
1965  {
1966  remove_service(reqp->req_id);
1967  auxp = reqp->prev;
1968  reqpp = (REQUEST_PTR *) reqp->reqpp;
1969  release_request(reqp, reqpp, 1);
1970  found = 1;
1971  reqp = auxp;
1972  }
1973  if(servp->id == (int)dnsp->dis_service_id)
1974  dnsp->dis_service_id = 0;
1975  if(servp->id == (int)dnsp->dis_client_id)
1976  dnsp->dis_client_id = 0;
1977  dis_hash_service_remove(servp);
1978  id_free(servp->id, SRC_DIS);
1979  free(servp->request_head);
1980  free(servp);
1981 /*
1982  if(dnsp != Default_DNS)
1983  {
1984  dnsp->dis_n_services--;
1985  n_services = dnsp->dis_n_services;
1986  }
1987  else
1988  {
1989  Dis_n_services--;
1990  n_services = Dis_n_services;
1991  }
1992 */
1993  dnsp->dis_n_services--;
1994  n_services = dnsp->dis_n_services;
1995 
1996  ENABLE_AST
1997  if(dnsp->serving)
1998  {
1999  if(n_services == 5)
2000  {
2001 /*
2002  dis_stop_serving();
2003 */
2005  }
2006  }
2007  return(found);
2008 }
DIS_DNS_CONN * dnsp
Definition: dis.c:87
int serving
Definition: dis.c:46
unsigned service_id
Definition: db_dim_client.c:22
int to_delete
Definition: dis.c:89
char str[80]
Definition: test_client.c:7
void * id_get_ptr(int id, SRC_TYPES type)
Definition: conn_handler.c:184
int release_request(REQUEST *reqp, REQUEST_PTR *reqpp, int remove)
Definition: dis_old.c:2341
int dis_n_services
Definition: dis.c:43
struct req_ent * prev
Definition: dis.c:54
struct reqp_ent * reqpp
Definition: dis.c:66
Definition: dim.h:530
int delay_delete
Definition: dis.c:88
Definition: dis.c:69
REQUEST * request_head
Definition: dis.c:86
void do_dis_stop_serving_dns(DIS_DNS_CONN *dnsp)
Definition: dis_old.c:2010
void unregister_service(DIS_DNS_CONN *dnsp, SERVICE *servp)
Definition: dis_old.c:895
#define DIMSVCINVAL
Definition: dim_common.h:290
int dis_hash_service_remove(SERVICE *servp)
Definition: dis_old.c:2898
void id_free(int id, SRC_TYPES type)
Definition: conn_handler.c:206
static void error_handler(int conn_id, int severity, int errcode, char *reason)
Definition: dis_old.c:2827
void free(void *mem)
DLL * dll_get_next(DLL *head, DLL *item)
Definition: dll.c:66
Definition: dis.c:92
int req_id
Definition: dis.c:57
unsigned int dis_service_id
Definition: dis.c:47
void remove_service(int req_id)
Definition: dis_old.c:1398
unsigned int dis_client_id
Definition: dis.c:48
Definition: dis.c:52
sprintf(name1,"NewService%d", i)
int id
Definition: dis.c:73

+ Here is the call graph for this function:

+ Here is the caller graph for this function: