From: Wouter Wijngaards Date: Wed, 7 Feb 2007 15:53:51 +0000 (+0000) Subject: cleanup dropped tcp. X-Git-Tag: release-0.0~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34e67e3c38124e4079f86071982b5939b376a694;p=thirdparty%2Funbound.git cleanup dropped tcp. git-svn-id: file:///svn/unbound/trunk@77 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/worker.c b/daemon/worker.c index 47ac7f422..918cbabbb 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -165,11 +165,13 @@ worker_handle_request(struct comm_point* c, void* arg, int error, LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), ret); return 1; } + comm_point_drop_reply(repinfo); return 0; } if(worker->num_requests > 0) { verbose(VERB_DETAIL, "worker: too many requests active. " "dropping incoming query."); + comm_point_drop_reply(repinfo); return 0; } /* answer it */ diff --git a/util/netevent.c b/util/netevent.c index 6824afbd2..cc4f2d5f3 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -693,7 +693,20 @@ comm_point_send_reply(struct comm_reply *repinfo) } } -void comm_point_stop_listening(struct comm_point* c) +void +comm_point_drop_reply(struct comm_reply* repinfo) +{ + if(!repinfo) + return; + log_assert(repinfo && repinfo->c); + log_assert(repinfo->c->type != comm_tcp_accept); + if(repinfo->c->type == comm_udp) + return; + reclaim_tcp_handler(repinfo->c); +} + +void +comm_point_stop_listening(struct comm_point* c) { log_info("comm point stop listening %x", (int)c); if(event_del(&c->ev->ev) != 0) { @@ -701,7 +714,8 @@ void comm_point_stop_listening(struct comm_point* c) } } -void comm_point_start_listening(struct comm_point* c, int newfd, int sec) +void +comm_point_start_listening(struct comm_point* c, int newfd, int sec) { log_info("comm point start listening %x", (int)c); if(c->type == comm_tcp_accept && !c->tcp_free) { diff --git a/util/netevent.h b/util/netevent.h index 4c0508e16..9822936ea 100644 --- a/util/netevent.h +++ b/util/netevent.h @@ -309,6 +309,12 @@ void comm_point_set_cb_arg(struct comm_point* c, void* arg); */ void comm_point_send_reply(struct comm_reply* repinfo); +/** + * Drop reply. Cleans up. + * @param repinfo: The reply info copied from a commpoint callback call. + */ +void comm_point_drop_reply(struct comm_reply* repinfo); + /** * Send an udp message over a commpoint. * @param c: commpoint to send it from.