cleanup dropped tcp.

git-svn-id: file:///svn/unbound/trunk@77 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-02-07 15:53:51 +00:00
parent b9f0fb076f
commit 34e67e3c38
3 changed files with 24 additions and 2 deletions

View file

@ -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 */

View file

@ -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) {

View file

@ -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.