Don't assume send is always ok
This commit is contained in:
parent
14b6f4624a
commit
e3baa21bb0
@ -293,8 +293,10 @@ check_gen_tcp(TcpSock) ->
|
|||||||
|
|
||||||
gen_tcp_snd_msg(S = {TcpSock, _, _}, Msg) ->
|
gen_tcp_snd_msg(S = {TcpSock, _, _}, Msg) ->
|
||||||
Len = byte_size(Msg),
|
Len = byte_size(Msg),
|
||||||
ok = gen_tcp:send(TcpSock, <<Len:16, Msg/binary>>),
|
case gen_tcp:send(TcpSock, <<Len:16, Msg/binary>>) of
|
||||||
{ok, S}.
|
ok -> {ok, S};
|
||||||
|
Err = {error, _} -> Err
|
||||||
|
end.
|
||||||
|
|
||||||
gen_tcp_rcv_msg({TcpSock, Active, Buf}, Timeout) ->
|
gen_tcp_rcv_msg({TcpSock, Active, Buf}, Timeout) ->
|
||||||
receive {tcp, TcpSock, Data} ->
|
receive {tcp, TcpSock, Data} ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user