From: Wouter Wijngaards Date: Fri, 24 May 2019 07:35:38 +0000 (+0200) Subject: - Fix that spoolbuf is not used to store tcp pipelined response X-Git-Tag: release-1.9.2rc1~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b77c9d6763686264d44dfd926c8cb4f2f03a43a;p=thirdparty%2Funbound.git - Fix that spoolbuf is not used to store tcp pipelined response between mesh send and callback end. --- diff --git a/doc/Changelog b/doc/Changelog index 75c5562f9..91d93e248 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +24 May 2019: Wouter + - Fix that spoolbuf is not used to store tcp pipelined response + between mesh send and callback end. + 20 May 2019: Wouter - Note that so-reuseport at extreme load is better turned off, otherwise queries are not distributed evenly, on Linux 4.4.x. diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index b73a0cc95..a7a5ac0cb 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -1786,12 +1786,6 @@ tcp_req_info_handle_readdone(struct tcp_req_info* req) /* If mesh failed(mallocfail) and called commpoint_send_reply with * something like servfail then we pick up that reply below. */ if(req->is_reply) { - /* reply from mesh is in the spool_buffer */ - sldns_buffer_clear(c->buffer); - sldns_buffer_write(c->buffer, - sldns_buffer_begin(req->spool_buffer), - sldns_buffer_limit(req->spool_buffer)); - sldns_buffer_flip(c->buffer); goto send_it; } @@ -1870,7 +1864,14 @@ void tcp_req_info_send_reply(struct tcp_req_info* req) { if(req->in_worker_handle) { - /* It is in the right buffer to answer straight away */ + /* reply from mesh is in the spool_buffer */ + /* copy now, so that the spool buffer is free for other tasks + * before the callback is done */ + sldns_buffer_clear(req->cp->buffer); + sldns_buffer_write(req->cp->buffer, + sldns_buffer_begin(req->spool_buffer), + sldns_buffer_limit(req->spool_buffer)); + sldns_buffer_flip(req->cp->buffer); req->is_reply = 1; return; }