]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix for #558: clear the UB_EV_TIMEOUT bit before adding an event.
authorGeorge Thessalonikefs <george@nlnetlabs.nl>
Fri, 5 Nov 2021 10:21:30 +0000 (11:21 +0100)
committerGeorge Thessalonikefs <george@nlnetlabs.nl>
Fri, 5 Nov 2021 10:21:30 +0000 (11:21 +0100)
doc/Changelog
util/netevent.c

index 9d102e111349bfba1f8d20c2187a21659fb8e822..4d4a6a5699abcaf74b09ee640a6ad73033aa4cc9 100644 (file)
@@ -1,6 +1,7 @@
 5 November 2021: George
        - Fix for #558: fix loop in comm_point->tcp_free when a comm_point is
          reclaimed more than once during callbacks.
+       - Fix for #558: clear the UB_EV_TIMEOUT bit before adding an event.
 
 5 November 2021: Wouter
        - Fix that forward-zone name is documented as the full name of the
index a54f01c762422468c72c02faf8ae2c99536624f9..c0567ed1375ddafd0bc417e84109f9e2668642c7 100644 (file)
@@ -4173,6 +4173,10 @@ comm_point_start_listening(struct comm_point* c, int newfd, int msec)
                c->timeout->tv_sec = msec/1000;
                c->timeout->tv_usec = (msec%1000)*1000;
 #endif /* S_SPLINT_S */
+       } else {
+               if(msec == 0 || !c->timeout) {
+                       ub_event_del_bits(c->ev->ev, UB_EV_TIMEOUT);
+               }
        }
        if(c->type == comm_tcp || c->type == comm_http) {
                ub_event_del_bits(c->ev->ev, UB_EV_READ|UB_EV_WRITE);
@@ -4197,6 +4201,7 @@ comm_point_start_listening(struct comm_point* c, int newfd, int msec)
        }
        if(ub_event_add(c->ev->ev, msec==0?NULL:c->timeout) != 0) {
                log_err("event_add failed. in cpsl.");
+               return;
        }
        c->event_added = 1;
 }
@@ -4210,11 +4215,15 @@ void comm_point_listen_for_rw(struct comm_point* c, int rd, int wr)
                }
                c->event_added = 0;
        }
+       if(!c->timeout) {
+               ub_event_del_bits(c->ev->ev, UB_EV_TIMEOUT);
+       }
        ub_event_del_bits(c->ev->ev, UB_EV_READ|UB_EV_WRITE);
        if(rd) ub_event_add_bits(c->ev->ev, UB_EV_READ);
        if(wr) ub_event_add_bits(c->ev->ev, UB_EV_WRITE);
        if(ub_event_add(c->ev->ev, c->timeout) != 0) {
                log_err("event_add failed. in cplf.");
+               return;
        }
        c->event_added = 1;
 }