]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix that spoolbuf is not used to store tcp pipelined response
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 24 May 2019 07:35:38 +0000 (09:35 +0200)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 24 May 2019 07:35:38 +0000 (09:35 +0200)
  between mesh send and callback end.

doc/Changelog
services/listen_dnsport.c

index 75c5562f9386a5d1ca9d80f8bffb92a00bd55b9e..91d93e2481c931b4555da7ed99023505064c55c6 100644 (file)
@@ -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.
index b73a0cc95b6d7db5359a391cfc640c971577cd21..a7a5ac0cbccac2f76a727d65832ce91f97189f2d 100644 (file)
@@ -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;
        }