diff --git a/src/tls/tls.erl b/src/tls/tls.erl index ffbae68c9..e307ae71e 100644 --- a/src/tls/tls.erl +++ b/src/tls/tls.erl @@ -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 ->