25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Ignore Length argument to tls:recv/[23] (EJAB-1327)

The Length argument cannot be used for gen_tcp:recv/3, because the
compressed size does not equal the desired uncompressed one.
This commit is contained in:
Andreas Köhler 2010-10-22 19:51:23 +02:00 committed by Badlop
parent 1579bf2d18
commit 70c247d357

View File

@ -153,8 +153,10 @@ tls_to_tcp(#tlssock{tcpsock = TCPSocket, tlsport = Port}) ->
recv(Socket, Length) ->
recv(Socket, Length, infinity).
recv(#tlssock{tcpsock = TCPSocket} = TLSSock,
Length, Timeout) ->
case gen_tcp:recv(TCPSocket, Length, Timeout) of
_Length, Timeout) ->
%% The Length argument cannot be used for gen_tcp:recv/3, because the
%% compressed size does not equal the desired uncompressed one.
case gen_tcp:recv(TCPSocket, 0, Timeout) of
{ok, Packet} ->
recv_data(TLSSock, Packet);
{error, _Reason} = Error ->