[erlang-questions] ssl timing issue in R15B?

Attila Rajmund Nohl <>
Fri Mar 23 18:16:10 CET 2012


2012/3/23 Lukas P <>:
> Hello.
>
> I think that I have been hit by a SSL timing issue in R15B. My
> functional test (= SSL/TCP client) crahes my server unless the test
> contains a sleep.
>
> The tested server implements a TCP based, line oriented protocol.
> Switch to SSL can be started with a "STARTTLS\r\n" command.
>
> The functional test starts a TCP connection and upgrades it to SSL:
>
> upgrade_connection_to_ssl(Socket) ->
>    SendResult = gen_tcp:send(Socket, "STARTTLS\r\n"),
>    %timer:sleep(10), % workaround for a SSL timing bug
>    SslConnectResult = case SendResult of
>        ok ->
>            ssl:connect(Socket, [{active, false}, {packet, line}, list], 2000);
>        {error, Reason1} ->
>            {error, Reason1}
>    end,
>    ...
>
> After the server receives "STARTTLS\r\n", it performs ssl:ssl_accept
> on the socket:
>
>    inet:setopts(Socket, [{active, false}]),

Don't you need a {reuseaddr, true} option here? The default is false.



More information about the erlang-questions mailing list