Chris, The main thing here is that it isn't necessary to call `uv_accept()` in a `connection_cb`. So probably you could build your feature with existing API.
Still it would be great to hear Saul's and Ben's comments on it, but I think that the way it works right now is for a two reasons: * EMFILE trickery * Controlling pressure by stopping listening if no `uv_accept()` was called Cheers, Fedor. On Tue, Jul 22, 2014 at 2:32 AM, Chris Dickinson < [email protected]> wrote: > Hi all, > > I'm currently working on a feature for Node that would allow Node to apply > backpressure to incoming socket connections -- specifically, letting them > pool in the kernel if JS is currently busy. > In the course of implementing this feature, I found that it was impossible > to keep libuv from accept()'ing the socket from the Node side. > Specifically, uv__server_io calls accept() before the > connection_cb() [1]. In order to let the client apply backpressure / keep > sockets waiting in the kernel queue, it would be necessary to move the > accept() call & associated logic into uv_accept, > so that the connection_cb() can trigger accept() itself. Is this a sane > course of action? The only caveat I saw was that the emfile trick[2] would > have to be moved / otherwise accounted for somehow. > > Thanks for your feedback! > Chris > > [1]: > https://github.com/joyent/libuv/blob/06c60e9662fea752d77237857bbf2c9ea5889a00/src/unix/stream.c#L468 > [2]: > https://github.com/joyent/libuv/blob/06c60e9662fea752d77237857bbf2c9ea5889a00/src/unix/stream.c#L415 > > -- > You received this message because you are subscribed to the Google Groups > "libuv" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/libuv. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
