[erlang-questions] Abandoned (ranch) connection processes?

Fred Hebert mononcqc@REDACTED
Thu Feb 15 12:56:23 CET 2018


On 02/15, Roger Lipscombe wrote:
>OK. Let me rephrase that:
>
>- {active, once} obviously has something in place to handle data
>arriving and closed sockets *in between* calls to {active, once} --
>i.e. it'll be {active, false} for a brief interval. I last looked at
>this code in 17.x (before the gen_statem refactoring), so I'm not sure
>where it lives now.
>- does it deal correctly with closed sockets that close before the
>*first* call to {active, once}? In other words: can I expect an
>ssl_closed message in this case? Is there something special about the
>first call?
>

Nothing like a quick experiment to show:

    5> {ok, S} = ssl:connect("google.com", 443, [{active, false}]).
    {ok,{sslsocket,{gen_tcp,#Port<0.953>,tls_connection,
                            undefined},
                   <0.91.0>}}
    6> ssl:close(S).
    ok
    7> ssl:setopts(S, [{active,once}]).
    {error,closed}
    8> flush().
    ok

It looks like you do have to check the result of setopts to find that 
the connections has failed early.



More information about the erlang-questions mailing list