Add timeouts to transport_accept and handshake in tcp_server
This commit is contained in:
@@ -30,7 +30,7 @@ handle_cast(_Msg, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
handle_info(accept, State = #state{socket = Socket}) ->
|
||||
case ssl:transport_accept(Socket) of
|
||||
case ssl:transport_accept(Socket, 5000) of
|
||||
{ok, TlsSocket} ->
|
||||
self() ! {handshake, TlsSocket},
|
||||
self() ! accept;
|
||||
@@ -39,7 +39,7 @@ handle_info(accept, State = #state{socket = Socket}) ->
|
||||
end,
|
||||
{noreply, State};
|
||||
handle_info({handshake, TlsSocket}, State) ->
|
||||
case ssl:handshake(TlsSocket) of
|
||||
case ssl:handshake(TlsSocket, 5000) of
|
||||
{ok, ClientSocket} ->
|
||||
{ok, Pid} = session_sup:start_session(ClientSocket),
|
||||
ok = ssl:controlling_process(ClientSocket, Pid);
|
||||
|
||||
Reference in New Issue
Block a user