Changeset d152b968149804cf9733697b36c02f4480a91f1b

Show
Ignore:
Timestamp:
09/27/09 03:06:50 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1254020810 +0000
git-parent:

[fd01712f1a1ee5b1313098087a6614adff90574d]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1254020810 +0000
Message:

make noit_poller_free_check safe to call externally and expose it

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_check.c

    rb7718bc rd152b96  
    618618} 
    619619 
    620 void 
    621 noit_poller_free_check(noit_check_t *checker) { 
    622   noit_module_t *mod; 
    623   mod = noit_module_lookup(checker->module); 
    624   if(mod->cleanup) mod->cleanup(mod, checker); 
    625   if(checker->fire_event) { 
    626      eventer_remove(checker->fire_event); 
    627      free(checker->fire_event->closure); 
    628      eventer_free(checker->fire_event); 
    629      checker->fire_event = NULL; 
    630   } 
    631   if(checker->closure) free(checker->closure); 
    632   if(checker->target) free(checker->target); 
    633   if(checker->module) free(checker->module); 
    634   if(checker->name) free(checker->name); 
    635   if(checker->config) { 
    636     noit_hash_destroy(checker->config, free, free); 
    637     free(checker->config); 
    638     checker->config = NULL; 
    639   } 
    640   free(checker); 
    641 } 
    642  
    643620/* A quick little list of recycleable checks.  This list never really 
    644621 * grows large, so no sense in thinking too hard about the algorithmic 
     
    656633  checker_rcb = n; 
    657634} 
     635void 
     636noit_poller_free_check(noit_check_t *checker) { 
     637  noit_module_t *mod; 
     638 
     639  if(checker->flags & NP_RUNNING) { 
     640    recycle_check(checker); 
     641    return; 
     642  } 
     643 
     644  mod = noit_module_lookup(checker->module); 
     645  if(mod->cleanup) mod->cleanup(mod, checker); 
     646  if(checker->fire_event) { 
     647     eventer_remove(checker->fire_event); 
     648     free(checker->fire_event->closure); 
     649     eventer_free(checker->fire_event); 
     650     checker->fire_event = NULL; 
     651  } 
     652  if(checker->closure) free(checker->closure); 
     653  if(checker->target) free(checker->target); 
     654  if(checker->module) free(checker->module); 
     655  if(checker->name) free(checker->name); 
     656  if(checker->config) { 
     657    noit_hash_destroy(checker->config, free, free); 
     658    free(checker->config); 
     659    checker->config = NULL; 
     660  } 
     661  free(checker); 
     662} 
    658663static int 
    659664check_recycle_bin_processor(eventer_t e, int mask, void *closure, 
     
    694699  noit_skiplist_remove(&polls_by_name, checker, NULL); 
    695700  noit_hash_delete(&polls, (char *)in, UUID_SIZE, NULL, NULL); 
    696  
    697   if(checker->flags & NP_RUNNING) { 
    698     recycle_check(checker); 
    699     return 0; 
    700   } 
    701701 
    702702  noit_poller_free_check(checker); 
  • src/noit_check.h

    r7010bc5 rd152b96  
    221221API_EXPORT(noit_check_t *) 
    222222  noit_check_clone(uuid_t in); 
     223API_EXPORT(void) 
     224  noit_poller_free_check(noit_check_t *checker); 
    223225API_EXPORT(noit_check_t *) 
    224226  noit_check_watch(uuid_t in, int period);