[erlang-questions] Trouble with accepting SSL on slow connections

Per Hedeland per@REDACTED
Sun Feb 24 00:11:02 CET 2008


"Gurgen Tumanian" <tumanian@REDACTED> wrote:
>
>I am having trouble with accepting SSl connections on slow links in case of
>delays over 2000ms. ssl:ssl_accept fails with {error, esslconnect}.
[snip]
>As far as i understand the SSL_accept(that handles the accept in ssl_esock)
>function should have tried continuously  on receiveing client certificate if
>the OS reported EAGAIN.

No, in non-blocking mode (which ssl_esock uses) it's supposed to do just
what your trace showed, return -1 with SSL_ERROR_WANT_READ, which tells
the caller that it should put the socket file descriptor back in its
poll set and call SSL_accept again when poll/select says that there is
(may be) something to read - otherwise the non-blocking mode would be
completely defeated, and the caller could be stuck forever if a client
yanked the network cable or whatever.

As far as I can see ssl_esock follows this protocol, and the loop you
show is exactly what is supposed to be going on. The question then is
why it gives up after 2000 ms. Are you using ssl:ssl_accept/2, i.e. with
a timeout?

--Per Hedeland



More information about the erlang-questions mailing list