/* * void eventDelete(EVH *func, void *arg) * * Input: Function handler, argument that was passed. * Output: None * Side Effects: Removes the event from the event list */ void eventDelete(EVH *func, void *arg) { int i = eventFind(func, arg); if (i == -1) return; event_table[i].name = NULL; event_table[i].func = NULL; event_table[i].arg = NULL; event_table[i].active = 0; }
static void wccpHereIam(void *voidnotused) { debug(80, 6) ("wccpHereIam: Called\n"); wccp_here_i_am.id = wccp_i_see_you.id; send(theOutWccpConnection, &wccp_here_i_am, sizeof(wccp_here_i_am), 0); if (!eventFind(wccpHereIam, NULL)) eventAdd("wccpHereIam", wccpHereIam, NULL, 10.0, 1); }
void wccpInit(void) { debug(80, 5) ("wccpInit: Called\n"); memset(&wccp_here_i_am, '\0', sizeof(wccp_here_i_am)); wccp_here_i_am.type = htonl(WCCP_HERE_I_AM); wccp_here_i_am.version = htonl(Config.Wccp.version); wccp_here_i_am.revision = htonl(WCCP_REVISION); change = 0; last_assign_buckets_change = 0; if (Config.Wccp.router.s_addr != any_addr.s_addr) if (!eventFind(wccpHereIam, NULL)) eventAdd("wccpHereIam", wccpHereIam, NULL, 5.0, 1); }
static void peerRefreshDNS(void *data) { peer *p = NULL; if (eventFind(peerRefreshDNS, NULL)) eventDelete(peerRefreshDNS, NULL); if (!data && 0 == stat5minClientRequests()) { /* no recent client traffic, wait a bit */ eventAddIsh("peerRefreshDNS", peerRefreshDNS, NULL, 180.0, 1); return; } for (p = Config.peers; p; p = p->next) { ipcache_nbgethostbyname(p->host, peerDNSConfigure, p); } /* Reconfigure the peers every hour */ eventAddIsh("peerRefreshDNS", peerRefreshDNS, NULL, 3600.0, 1); }