Handle errors in start_link (tcp_closed)

This commit is contained in:
Hans Svensson
2018-04-17 09:00:22 +02:00
parent 41b8efd201
commit fc510c07a1
2 changed files with 14 additions and 8 deletions
+4 -2
View File
@@ -237,8 +237,10 @@ tcp_handshake(TcpSock, Role, Options) ->
case handshake(Options, Role, ComState) of
{ok, #{ rx := Rx, tx := Tx, final_state := FState }, #{ state := {_, _, Buf} }} ->
{ok, Pid} = enoise_connection:start_link(TcpSock, Rx, Tx, self(), {Active, Buf}),
{ok, #enoise{ pid = Pid }, FState};
case enoise_connection:start_link(TcpSock, Rx, Tx, self(), {Active, Buf}) of
{ok, Pid} -> {ok, #enoise{ pid = Pid }, FState};
Err = {error, _} -> Err
end;
Err = {error, _} ->
Err
end;