From: Wouter Wijngaards Date: Fri, 5 Apr 2019 14:11:28 +0000 (+0000) Subject: - Fix to reinit event structure for accepted TCP (and TLS) sockets. X-Git-Tag: final-svn-state~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=348cbab016f824a336b65d0091310fe5cd58e762;p=thirdparty%2Funbound.git - Fix to reinit event structure for accepted TCP (and TLS) sockets. git-svn-id: file:///svn/unbound/trunk@5148 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 2c76f7a2e..110ab8265 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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. diff --git a/util/netevent.c b/util/netevent.c index 5d9422836..261eb3dc8 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -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,