mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-28 02:29:51 -05:00
in tcp write callback routine dont reset read byte count if write and read.
in tcp write callback and write and read and write is done perform callback. tcp connection is selected to not toggle readwrite and give closed callback.
This commit is contained in:
parent
d033ce6c23
commit
64c8d18814
2 changed files with 14 additions and 2 deletions
|
|
@ -516,6 +516,8 @@ outnet_tcp_take_into_use(struct waiting_tcp* w)
|
|||
log_assert(w->pkt);
|
||||
log_assert(w->pkt_len > 0);
|
||||
log_assert(w->addrlen > 0);
|
||||
pend->c->tcp_do_toggle_rw = 0;
|
||||
pend->c->tcp_do_close = 0;
|
||||
/* open socket */
|
||||
s = outnet_get_tcp_fd(&w->addr, w->addrlen, w->outnet->tcp_mss, w->outnet->ip_dscp);
|
||||
|
||||
|
|
|
|||
|
|
@ -995,13 +995,23 @@ tcp_callback_writer(struct comm_point* c)
|
|||
sldns_buffer_clear(c->buffer);
|
||||
if(c->tcp_do_toggle_rw)
|
||||
c->tcp_is_reading = 1;
|
||||
c->tcp_byte_count = 0;
|
||||
if(!c->tcp_write_and_read)
|
||||
c->tcp_byte_count = 0;
|
||||
/* switch from listening(write) to listening(read) */
|
||||
if(c->tcp_req_info) {
|
||||
tcp_req_info_handle_writedone(c->tcp_req_info);
|
||||
} else {
|
||||
comm_point_stop_listening(c);
|
||||
comm_point_start_listening(c, -1, c->tcp_timeout_msec);
|
||||
if(c->tcp_write_and_read) {
|
||||
fptr_ok(fptr_whitelist_comm_point(c->callback));
|
||||
if( (*c->callback)(c, c->cb_arg, NETEVENT_PKT_WRITTEN,
|
||||
&c->repinfo) ) {
|
||||
comm_point_start_listening(c, -1,
|
||||
c->tcp_timeout_msec);
|
||||
}
|
||||
} else {
|
||||
comm_point_start_listening(c, -1, c->tcp_timeout_msec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue