static void expire_queries() { dns_query_t *q = NULL, *next = NULL; int i = 0; /* need to check for expired queries and either: a) recheck/change ns b) expire due to ttl */ if (query_head) { for (q = query_head; q; q = q->next) { if (q->expiretime <= now) { /* set in alloc_query */ if (q->next) next = q->next; egg_dns_cancel(q->id, 1); if (!next) break; q = next; } } } for (i = 0; i < ncache; i++) { if (cache_expired(i)) { cache_del(i); if (i == ncache) break; i--; } } }
static void kill_session(dcc_session_t *session) { if (session->ident_id != -1) egg_ident_cancel(session->ident_id, 0); if (session->dns_id != -1) egg_dns_cancel(session->dns_id, 0); if (session->ip) free(session->ip); if (session->host) free(session->host); if (session->ident) free(session->ident); if (session->nick) free(session->nick); free(session); }
/* If a connection times out, due to dns timeout or connect timeout. */ static int egg_connect_timeout(void *client_data) { connect_info_t *connect_info = (connect_info_t *) client_data; int idx, dns_id; idx = connect_info->idx; dns_id = connect_info->dns_id; connect_info->timer_id = -1; if (dns_id != -1) { /* dns_cancel will call connect_host_resolved for us, which * will filter up a "dns failed" error. */ egg_dns_cancel(dns_id, 1); } // else { // detach(client_data, idx); // sockbuf_on_eof(idx, EGGNET_LEVEL, -1, "Connect timed out"); // } return(0); }