I started looking into this code after seeing some strange errors in the log. Pretty sure this is caused by some additions, like thredis, but my quesitons are about the original code.
1. in src/networking.c, lines 728-729:
aeDeleteFileEvent(server.el,c->fd,AE_READABLE);
aeDeleteFileEvent(server.el,c->fd,AE_WRITABLE);
How come this is not a single call with a merged mask? Looks like the inner functions would easily support that.
Hunch: one of implementations (epoll/select/kqueue/etc.) doesn't support this..?
2. src/networking.c, line 888:
aeDeleteFileEvent(server.el,c->fd,AE_WRITABLE);
It looks like the conneciton is closed completely here -- but only WRITABLE flag is removed. Is there no reason to clean up READABLE as well?
3. src/ae_evport.c lines 209-217:
/*
* The fd is currently associated with the port. Like with the add case
* above, we must look at the full mask for the file descriptor before
* updating that association. We don't have a good way of knowing what the
* events are without looking into the eventLoop state directly. We rely on
* the fact that our caller has already updated the mask in the eventLoop.
*/
fullmask = eventLoop->events[fd].mask;
as opposed to ae.c line 161-162:
aeApiDelEvent(eventLoop, fd, mask);
fe->mask = fe->mask & (~mask);
... so ae_evport.c seems to rely on caller clearing the mask, first -- but caller clears it only after the call!?