diff options
author | Daniel Goertzen <[email protected]> | 2012-09-05 13:30:11 -0500 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-10-03 19:25:29 +0200 |
commit | 79d51c19399a5666eea74118d36812ade5a5b757 (patch) | |
tree | 66090045f13049078c3cb7cc86dfa3179d7a11ef /lib | |
parent | eaead6bf3d330fa909ca5feb33fb211d71891c20 (diff) | |
download | otp-79d51c19399a5666eea74118d36812ade5a5b757.tar.gz otp-79d51c19399a5666eea74118d36812ade5a5b757.tar.bz2 otp-79d51c19399a5666eea74118d36812ade5a5b757.zip |
ssh: Ensure that all data is sent before ssh:send returns.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ssh/src/ssh_connection.erl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index e3b8ebfb79..33c8e2aca7 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -319,7 +319,7 @@ channel_data(ChannelId, DataType, Data, case ssh_channel:cache_lookup(Cache, ChannelId) of #channel{remote_id = Id} = Channel0 -> - {SendList, Channel} = update_send_window(Channel0, DataType, + {SendList, Channel} = update_send_window(Channel0#channel{flow_control = From}, DataType, Data, Connection), Replies = lists:map(fun({SendDataType, SendData}) -> @@ -329,7 +329,7 @@ channel_data(ChannelId, DataType, Data, SendData)} end, SendList), FlowCtrlMsgs = flow_control(Replies, - Channel#channel{flow_control = From}, + Channel, Cache), {{replies, Replies ++ FlowCtrlMsgs}, Connection}; undefined -> @@ -1126,13 +1126,13 @@ flow_control(Channel, Cache) -> flow_control([], Channel, Cache) -> ssh_channel:cache_update(Cache, Channel), []; -flow_control([_|_], #channel{flow_control = From} = Channel, Cache) -> - case From of - undefined -> - []; - _ -> - [{flow_control, Cache, Channel, From, ok}] - end. + +flow_control([_|_], #channel{flow_control = From, + send_buf = []} = Channel, Cache) when From =/= undefined -> + [{flow_control, Cache, Channel, From, ok}]; +flow_control(_,_,_) -> + []. + encode_pty_opts(Opts) -> Bin = list_to_binary(encode_pty_opts2(Opts)), |