Skip to content

Instantly share code, notes, and snippets.

@gebi
Created September 25, 2012 13:19
Show Gist options
  • Save gebi/3781773 to your computer and use it in GitHub Desktop.
Save gebi/3781773 to your computer and use it in GitHub Desktop.
ssl setopt hang fix
ssl_setopts(SslSocket, Options) ->
Ref = erlang:now(),
PPid = self(),
Pid = spawn_link(fun() ->
ssl:setopts(SslSocket, Options),
PPid ! {self(), Ref, ssl_setopts_successful} end),
receive
{Pid, Ref, ssl_setopts_successful} -> ok
after ?SSL_SETOPTS_TIMEOUT ->
erlang:exit({error, timeout, {ssl_setopts, Options}})
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment