]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Review fixes in out of order processing.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 15 Jan 2019 10:27:00 +0000 (10:27 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 15 Jan 2019 10:27:00 +0000 (10:27 +0000)
git-svn-id: file:///svn/unbound/trunk@5035 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/listen_dnsport.c

index 09e4d96c08de506bdb4a146c3f90c78ede30ac6e..04cd0461eb30389791099ca60271741d671a7eba 100644 (file)
@@ -1,6 +1,7 @@
 15 January 2018: Wouter
        - In the out of order processing, reset byte count for (potential)
          partial read.
+       - Review fixes in out of order processing.
 
 14 January 2018: Wouter
        - streamtcp option -a send queries consecutively and prints answers
index 7db018f6df75af69504efd0b8a2f10aed3782ee4..b931d17b3228de1cc767a408199c606a740accab 100644 (file)
@@ -1691,6 +1691,11 @@ tcp_req_info_handle_writedone(struct tcp_req_info* req)
 {
        /* back to reading state, we finished this write event */
        sldns_buffer_clear(req->cp->buffer);
+       if(req->num_done_req == 0 && req->read_is_closed) {
+               /* no more to write and nothing to read, close it */
+               comm_point_drop_reply(&req->cp->repinfo);
+               return;
+       }
        req->cp->tcp_is_reading = 1;
        /* see if another result needs writing */
        tcp_req_pickup_next_result(req);
@@ -1712,7 +1717,10 @@ tcp_req_info_handle_readdone(struct tcp_req_info* req)
        req->is_drop = 0;
        req->is_reply = 0;
        req->in_worker_handle = 1;
-       /* handle the current request,  */
+       /* handle the current request */
+       /* this calls the worker handle request routine that could give
+        * a cache response, or localdata response, or drop the reply,
+        * or schedule a mesh entry for later */
        fptr_ok(fptr_whitelist_comm_point(c->callback));
        if( (*c->callback)(c, c->cb_arg, NETEVENT_NOERROR, &c->repinfo) ) {
                req->in_worker_handle = 0;
@@ -1727,9 +1735,16 @@ tcp_req_info_handle_readdone(struct tcp_req_info* req)
        }
        req->in_worker_handle = 0;
        /* it should be waiting in the mesh for recursion.
-        * If mesh failed(formerr) and called commpoint_drop_reply.  Then the
-        * mesh state has been cleared. */
+        * If mesh failed to add a new entry and called commpoint_drop_reply. 
+        * Then the mesh state has been cleared. */
        if(req->is_drop) {
+               /* we can now call drop_reply without recursing into ourselves
+                * whilst in the callback */
+               /* we have to close the stream because there is no reply,
+                * no servfail to send, but the query needs an action, for
+                * a stream that is close the connection */
+               sldns_buffer_clear(c->buffer);
+               comm_point_drop_reply(&c->repinfo);
                return;
        }
        /* If mesh failed(mallocfail) and called commpoint_send_reply with
@@ -1738,7 +1753,7 @@ tcp_req_info_handle_readdone(struct tcp_req_info* req)
                goto send_it;
        }
 
-       sldns_buffer_clear(req->cp->buffer);
+       sldns_buffer_clear(c->buffer);
        /* if pending answers, pick up an answer and start sending it */
        tcp_req_pickup_next_result(req);