From: W.C.A. Wijngaards Date: Fri, 26 Jun 2020 08:54:13 +0000 (+0200) Subject: in tcp write callback routine dont reset read byte count if write and read. X-Git-Tag: release-1.13.0rc1~5^2~54 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64c8d18814d09a66f47dcae79e2ade94f198166c;p=thirdparty%2Funbound.git 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. --- diff --git a/services/outside_network.c b/services/outside_network.c index ee8275c7f..8da5eeb64 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -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); diff --git a/util/netevent.c b/util/netevent.c index 2ca92b92d..bcff7a590 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -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); + } } }