Compare commits

..

3 Commits

Author SHA1 Message Date
cdo 15828b697d Add timeouts to transport_accept and handshake in tcp_server 2025-02-25 22:17:50 +00:00
cdo 236eed5505 Handle exit properly in session_server 2025-02-25 22:17:50 +00:00
cdo 727c0aedd6 Implement demo of DER comms 2025-02-25 22:17:50 +00:00
3 changed files with 6 additions and 2 deletions
+4
View File
@@ -32,6 +32,10 @@ handle_info({ssl, Socket, Data}, State) ->
ok
end,
{noreply, State};
handle_info({ssl_closed, _Socket}, State) ->
{stop, normal, State};
handle_info({ssl_error, _Socket, _Reason}, State) ->
{stop, normal, State};
handle_info(_Info, State) ->
{noreply, State}.
+2 -2
View File
@@ -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);