]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix to reinit event structure for accepted TCP (and TLS) sockets.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 5 Apr 2019 14:11:28 +0000 (14:11 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 5 Apr 2019 14:11:28 +0000 (14:11 +0000)
git-svn-id: file:///svn/unbound/trunk@5148 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/netevent.c

index 2c76f7a2ea9770414696bea7dba3d2fafd3a59e6..110ab826595bb2fc080729f204b61324e30dd241 100644 (file)
@@ -1,3 +1,6 @@
+5 April 2019: Wouter
+       - Fix to reinit event structure for accepted TCP (and TLS) sockets.
+
 4 April 2019: Wouter
        - Fix spelling error in log output for event method.
 
index 5d942283634d2be96aa4787ed08c0e85869a8d68..261eb3dc8ca16e3337d4907a2929e82fef58ec4e 100644 (file)
@@ -926,6 +926,14 @@ comm_point_tcp_accept_callback(int fd, short event, void* arg)
        }
        /* accept incoming connection. */
        c_hdl = c->tcp_free;
+       /* clear leftover flags from previous use, and then set the
+        * correct event base for the event structure for libevent */
+       ub_event_free(c_hdl->ev->ev);
+       c_hdl->ev->ev = ub_event_new(c_hdl->ev->base->eb->base, -1, UB_EV_PERSIST | UB_EV_READ | UB_EV_TIMEOUT, comm_point_tcp_handle_callback, c_hdl);
+       if(!c_hdl->ev->ev) {
+               log_warn("could not ub_event_new, dropped tcp");
+               return;
+       }
        log_assert(fd != -1);
        (void)fd;
        new_fd = comm_point_perform_accept(c, &c_hdl->repinfo.addr,