- Fix for #558: clear the UB_EV_TIMEOUT bit before adding an event.

This commit is contained in:
George Thessalonikefs 2021-11-05 11:21:30 +01:00
parent 431b749d7a
commit 24eded6ef9
2 changed files with 10 additions and 0 deletions

View file

@ -1,6 +1,7 @@
5 November 2021: George 5 November 2021: George
- Fix for #558: fix loop in comm_point->tcp_free when a comm_point is - Fix for #558: fix loop in comm_point->tcp_free when a comm_point is
reclaimed more than once during callbacks. reclaimed more than once during callbacks.
- Fix for #558: clear the UB_EV_TIMEOUT bit before adding an event.
5 November 2021: Wouter 5 November 2021: Wouter
- Fix that forward-zone name is documented as the full name of the - Fix that forward-zone name is documented as the full name of the

View 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_sec = msec/1000;
c->timeout->tv_usec = (msec%1000)*1000; c->timeout->tv_usec = (msec%1000)*1000;
#endif /* S_SPLINT_S */ #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) { if(c->type == comm_tcp || c->type == comm_http) {
ub_event_del_bits(c->ev->ev, UB_EV_READ|UB_EV_WRITE); 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) { if(ub_event_add(c->ev->ev, msec==0?NULL:c->timeout) != 0) {
log_err("event_add failed. in cpsl."); log_err("event_add failed. in cpsl.");
return;
} }
c->event_added = 1; 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; 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); 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(rd) ub_event_add_bits(c->ev->ev, UB_EV_READ);
if(wr) ub_event_add_bits(c->ev->ev, UB_EV_WRITE); if(wr) ub_event_add_bits(c->ev->ev, UB_EV_WRITE);
if(ub_event_add(c->ev->ev, c->timeout) != 0) { if(ub_event_add(c->ev->ev, c->timeout) != 0) {
log_err("event_add failed. in cplf."); log_err("event_add failed. in cplf.");
return;
} }
c->event_added = 1; c->event_added = 1;
} }