diff options
author | Ingela Anderton Andin <[email protected]> | 2012-09-20 17:23:32 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-09-24 17:30:03 +0200 |
commit | 425d8b7a53362d2c32a753d850bec14ebd57951a (patch) | |
tree | 3803704441fab2b36ad28d5c09d8fe93cca02a82 /lib/ssh/src | |
parent | b58ce62a0cf296ca8cd8cd77b053bc70ecf28758 (diff) | |
download | otp-425d8b7a53362d2c32a753d850bec14ebd57951a.tar.gz otp-425d8b7a53362d2c32a753d850bec14ebd57951a.tar.bz2 otp-425d8b7a53362d2c32a753d850bec14ebd57951a.zip |
ssh: Will not hang if you attempt to send empty binary
Diffstat (limited to 'lib/ssh/src')
-rw-r--r-- | lib/ssh/src/ssh_connection.erl | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index c2a7c63cbe..e3b8ebfb79 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -441,7 +441,7 @@ handle_msg(#ssh_msg_channel_window_adjust{recipient_channel = ChannelId, {SendList, Channel} = %% TODO: Datatype 0 ? update_send_window(Channel0#channel{send_window_size = Size + Add}, - 0, <<>>, Connection), + 0, undefined, Connection), Replies = lists:map(fun({Type, Data}) -> {connection_reply, ConnectionPid, @@ -1073,14 +1073,15 @@ request_reply_or_data(#channel{local_id = ChannelId, user = ChannelPid}, false -> {{channel_data, ChannelPid, Reply}, Connection} end. +update_send_window(Channel, _, undefined, + #connection{channel_cache = Cache}) -> + do_update_send_window(Channel, Channel#channel.send_buf, Cache); -update_send_window(Channel0, DataType, Data, - #connection{channel_cache = Cache}) -> - Buf0 = if Data == <<>> -> - Channel0#channel.send_buf; - true -> - Channel0#channel.send_buf ++ [{DataType, Data}] - end, +update_send_window(Channel, DataType, Data, + #connection{channel_cache = Cache}) -> + do_update_send_window(Channel, Channel#channel.send_buf ++ [{DataType, Data}], Cache). + +do_update_send_window(Channel0, Buf0, Cache) -> {Buf1, NewSz, Buf2} = get_window(Buf0, Channel0#channel.send_packet_size, Channel0#channel.send_window_size), |