[erlang-questions] sendfile stolen fd

Zabrane Mickael zabrane3@REDACTED
Mon Apr 18 09:43:48 CEST 2011


Hi Steve,

Le 18 avr. 2011 à 03:43, Steve Vinoski a écrit :

> Just curious: do you ever set the socket into {active, once} or
> {active, true} mode?

That's correct Steve. I the server side, the socket is set to {active, false} in the beginning.

> I'm guessing the "stealing" is the result of a
> socket select event invoking callbacks within multiple drivers, so if
> tcp_inet is interested in read events concurrently with sendfile being
> interested in write events, and the socket becomes both readable and
> writeable, I think a "steal" could occur.

But when HTTP headers parsing is done, I change it to {active, true} by calling:
ok = inet:setopts(Socket, [{active, true}, 
                               {packet, raw}, 
                               {delay_send, true},
                               {keepalive, true}]),


Regards
Zab


More information about the erlang-questions mailing list