Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
1033-ssh-don-t-adjust-window-if-connection-seem...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1033-ssh-don-t-adjust-window-if-connection-seems-closed.patch of Package erlang
From debee60b5af61fdf2f9e240ddd081e9c747f90af Mon Sep 17 00:00:00 2001 From: Jakub Witczak <kuba@erlang.org> Date: Wed, 29 May 2024 18:06:19 +0200 Subject: [PATCH] ssh: don't adjust window if connection seems closed - fixes race condition between connection closing and window adjustment --- lib/ssh/src/ssh_connection.erl | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index 34e97ba6ca..9d9034110e 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -548,21 +548,23 @@ handle_msg(#ssh_msg_channel_extended_data{recipient_channel = ChannelId, channel_data_reply_msg(ChannelId, Connection, DataType, Data); handle_msg(#ssh_msg_channel_window_adjust{recipient_channel = ChannelId, - bytes_to_add = Add}, + bytes_to_add = Add}, #connection{channel_cache = Cache} = Connection, _, _SSH) -> - #channel{send_window_size = Size, remote_id = RemoteId} = - Channel0 = ssh_client_channel:cache_lookup(Cache, ChannelId), - - {SendList, Channel} = %% TODO: Datatype 0 ? - update_send_window(Channel0#channel{send_window_size = Size + Add}, - 0, undefined, Connection), - - Replies = lists:map(fun({Type, Data}) -> - {connection_reply, channel_data_msg(RemoteId, Type, Data)} - end, SendList), - FlowCtrlMsgs = flow_control(Channel, Cache), - {Replies ++ FlowCtrlMsgs, Connection}; - + case ssh_client_channel:cache_lookup(Cache, ChannelId) of + Channel0 = #channel{send_window_size = Size, + remote_id = RemoteId} -> + {SendList, Channel} = %% TODO: Datatype 0 ? + update_send_window(Channel0#channel{send_window_size = Size + Add}, + 0, undefined, Connection), + Replies = lists:map(fun({Type, Data}) -> + {connection_reply, + channel_data_msg(RemoteId, Type, Data)} + end, SendList), + FlowCtrlMsgs = flow_control(Channel, Cache), + {Replies ++ FlowCtrlMsgs, Connection}; + undefined -> + {[], Connection} + end; handle_msg(#ssh_msg_channel_open{channel_type = "session" = Type, sender_channel = RemoteId, initial_window_size = WindowSz, -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor