Show
Ignore:
Timestamp:
03/17/08 04:06:17 (10 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1205726777 +0000
git-parent:

[065b0349f122c8e5f44538bed5636ea8b49362b6]

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

check code consolidation. allow modules to be more terse and add convenience functions to make writing completely asynch checkers much easier. (add a postgres proof-of-concept asynch checker

Files:

Legend:

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

    r9a6060c r4b96846  
    115115} 
    116116 
     117void 
     118noit_check_run_full_asynch(noit_check_t *check, eventer_func_t callback) { 
     119  eventer_t e; 
     120  e = eventer_alloc(); 
     121  e->fd = -1; 
     122  e->mask = EVENTER_ASYNCH;  
     123  memcpy(&e->whence, &__now, sizeof(__now)); 
     124  p_int.tv_sec = check->timeout / 1000; 
     125  p_int.tv_usec = (check->timeout % 1000) * 1000; 
     126  add_timeval(e->whence, p_int, &e->whence); 
     127  e->callback = ssh2_connect_complete; 
     128  e->closure =  check->closure; 
     129  eventer_add(e); 
     130} 
     131 
     132void 
     133noit_check_make_attrs(noit_check_t *check, noit_hash_table *attrs) { 
     134#define CA_STORE(a,b) noit_hash_store(attrs, a, strlen(a), b) 
     135  CA_STORE("target", check->target); 
     136  CA_STORE("name", check->name); 
     137  CA_STORE("module", check->module); 
     138} 
     139void 
     140noit_check_release_attrs(noit_hash_table *attrs) { 
     141  noit_hash_destroy(attrs, NULL, NULL); 
     142}