diff options
author | Jens Geyer <jensg@apache.org> | 2022-08-30 22:09:56 +0200 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2022-08-30 22:09:56 +0200 |
commit | bce985be5507eed5643587219dc647ce48a1091c (patch) | |
tree | 9978285e725befd6e776d0aa9ba677f0b4f4f865 | |
parent | 60fef438188958b5439c4d207f1bfa753a218938 (diff) | |
download | thrift-bce985be5507eed5643587219dc647ce48a1091c.tar.gz |
Revert "Update thrift_socket_transport.erl"
This reverts commit 60fef438188958b5439c4d207f1bfa753a218938.
-rw-r--r-- | lib/erl/src/thrift_socket_transport.erl | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/erl/src/thrift_socket_transport.erl b/lib/erl/src/thrift_socket_transport.erl index fe210da97..fa10ed0c6 100644 --- a/lib/erl/src/thrift_socket_transport.erl +++ b/lib/erl/src/thrift_socket_transport.erl @@ -70,24 +70,7 @@ when is_integer(Len), Len >= 0 -> X when X >= Len -> {Result, Remaining} = split_binary(Binary, Len), {State#t_socket{buffer = Remaining}, {ok, Result}}; - _ -> - %%recv(State, Len) - loop_recv(State,Len,Len) - end. - -loop_recv(State=#t_socket{buffer = Buf},ReadLen,NextReadLen) when NextReadLen =< 0-> - {Result,Remaining}=split_binary(Buf,ReadLen), - {State#t_socket{buffer = Remaining},{ok,Result}}; - -loop_recv(State=#t_socket{socket = Socket,buffer = Buf},ReadLen,NextReadLen) when NextReadLen >0 -> - case gen_tcp:recv(Socket,0,State#t_socket.recv_timeout) of - {error,Error}-> - gen_tcp:close(Socket), - {State,{error,Error}}; - {ok,Data}-> - Binary=iolist_to_binary([Buf,Data]), - Give=min(iolist_size(Binary),ReadLen), - loop_recv(State#t_socket{buffer = Binary},ReadLen,ReadLen-Give) + _ -> recv(State, Len) end. recv(State = #t_socket{socket = Socket, buffer = Buf}, Len) -> |