Re:It ain't about the callbacks, it's about the flow control
by rbrcurtis on Thursday September 05, 2013 @04:37PM
(#6336761)
Combined with node-toobusy, pausing READ events sounds perfect, but I can't figure out how to do that. Can you explain?
Re:It ain't about the callbacks, it's about the flow control
by zzzcpan on Thursday September 05, 2013 @05:20PM
(#6337096)
Sorry, don't know much about nodejs. But it seems that node does have a way to remove/setup events, and pause read events:
http://nodejs.org/api/events.html#events_emitter_removeliste...
http://nodejs.org/api/net.html#net_socket_pause
Re:It ain't about the callbacks, it's about the flow control
by rbrcurtis on Friday September 06, 2013 @10:31AM
(#6340599)
Ahh ok. I thought you meant at the OS level.
Re:It ain't about the callbacks, it's about the flow control
by zzzcpan on Friday September 06, 2013 @11:43AM
(#6340972)
Well, kind of. Pause should instruct event loop to stop waiting for read events from the OS for particular fd, i.e. remove from epoll/kqueue, so new connections would stuck in backlog at the OS level.
To stop calling accept() you could remove or pause READ event for server's FD from event loop once the limit is reached and unpause once it goes down. Not a big deal.
> If 'write' is non-blocking _and_ always succeeds
Why would it always succeed? Obviously it should call back on completion.