Mercurial > hg > nginx
comparison src/event/modules/ngx_eventport_module.c @ 7807:e0844646099b
Events: fixed "port_dissociate() failed" alerts with eventport.
If an attempt is made to delete an event which was already reported,
port_dissociate() returns an error. Fix is avoid doing anything if
ev->active is not set.
Possible alternative approach would be to avoid calling ngx_del_event()
at all if ev->active is not set. This approach, however, will require
something else to re-add the other event of the connection, since both
read and write events are dissociated if an event is reported on a file
descriptor. Currently ngx_eventport_del_event() re-associates write
event if called to delete read event, and vice versa.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 28 Mar 2021 17:45:29 +0300 |
parents | efd71d49bde0 |
children |
comparison
equal
deleted
inserted
replaced
7806:2ed5d03c2d90 | 7807:e0844646099b |
---|---|
397 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno, | 397 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno, |
398 "port_associate() failed"); | 398 "port_associate() failed"); |
399 return NGX_ERROR; | 399 return NGX_ERROR; |
400 } | 400 } |
401 | 401 |
402 } else { | 402 } else if (ev->active) { |
403 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0, | 403 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0, |
404 "eventport del event: fd:%d", c->fd); | 404 "eventport del event: fd:%d", c->fd); |
405 | 405 |
406 if (port_dissociate(ep, PORT_SOURCE_FD, c->fd) == -1) { | 406 if (port_dissociate(ep, PORT_SOURCE_FD, c->fd) == -1) { |
407 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno, | 407 ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno, |