Skip to content

Commit 3511f2a

Browse files
committed
Merge branch 'maint'
2 parents d034e48 + 85ef200 commit 3511f2a

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

lib/ssh/test/ssh_connection_SUITE.erl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,19 @@ do_interrupted_send(Config, SendSize, EchoSize, SenderResult) ->
769769
ct:log("~p:~p ~p - That's what we expect :)",
770770
[?MODULE,?LINE, SenderResult]),
771771
ok;
772+
{SenderPid, {error, closed}} ->
773+
%% We called ssh:close(ConnectionRef) above while
774+
%% the sender was still pushing data (10 MB send,
775+
%% only 4 MB echoed). The connection teardown can
776+
%% race with the ongoing send, causing it to return
777+
%% {error, closed} instead of ok. Both outcomes are
778+
%% valid — the test's purpose is to verify the
779+
%% listener received correct echo data, not that
780+
%% the sender completes the full 10 MB transfer.
781+
ct:log("~p:~p sender got {error,closed} after "
782+
"ssh:close - acceptable race",
783+
[?MODULE,?LINE]),
784+
ok;
772785
Msg ->
773786
ct:log("~p:~p Not expected send result: ~p",[?MODULE,?LINE,Msg]),
774787
{fail, "Not expected msg"}

lib/ssh/test/ssh_protocol_SUITE.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,8 +1396,14 @@ kex_strict_violation(Config) ->
13961396
{send, ssh_msg_kexinit},
13971397
{match, #ssh_msg_kexinit{_='_'}, receive_msg},
13981398
{send, ssh_msg_kexdh_init_dup},
1399-
{match,# ssh_msg_kexdh_reply{_='_'}, receive_msg},
1400-
{match, disconnect(?SSH_DISCONNECT_KEY_EXCHANGE_FAILED), receive_msg}]},
1399+
{match, #ssh_msg_kexdh_reply{_='_'}, receive_msg},
1400+
%% Server processes first kexdh_init (sends newkeys), then
1401+
%% detects the duplicate and disconnects. Depending on timing
1402+
%% we may see newkeys, disconnect, or tcp_closed here.
1403+
%% The actual violation assertion is verified via event_logged.
1404+
{match, {'or', [#ssh_msg_newkeys{_='_'},
1405+
#ssh_msg_disconnect{code = ?SSH_DISCONNECT_KEY_EXCHANGE_FAILED},
1406+
tcp_closed]}, receive_msg}]},
14011407
{new_keys, "Message ssh_msg_newkeys in wrong state",
14021408
[receive_hello,
14031409
{send, hello},

0 commit comments

Comments
 (0)