mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Don't ignore send() result
This commit is contained in:
parent
b341a3cef3
commit
295bec8551
@ -245,14 +245,19 @@ handle_sync_event(_Event, _From, StateName,
|
||||
%%%-------------------------------------------------
|
||||
relay(MySocket, PeerSocket, Shaper) ->
|
||||
case gen_tcp:recv(MySocket, 0) of
|
||||
{ok, Data} ->
|
||||
gen_tcp:send(PeerSocket, Data),
|
||||
{NewShaper, Pause} = shaper:update(Shaper, byte_size(Data)),
|
||||
if Pause > 0 -> timer:sleep(Pause);
|
||||
true -> pass
|
||||
end,
|
||||
relay(MySocket, PeerSocket, NewShaper);
|
||||
_ -> stopped
|
||||
{ok, Data} ->
|
||||
case gen_tcp:send(PeerSocket, Data) of
|
||||
ok ->
|
||||
{NewShaper, Pause} = shaper:update(Shaper, byte_size(Data)),
|
||||
if Pause > 0 -> timer:sleep(Pause);
|
||||
true -> pass
|
||||
end,
|
||||
relay(MySocket, PeerSocket, NewShaper);
|
||||
{error, _} = Err ->
|
||||
Err
|
||||
end;
|
||||
{error, _} = Err ->
|
||||
Err
|
||||
end.
|
||||
|
||||
%%%------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user