From db188040ea8c1a8e3f6ae581c1806fbc77f08335 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 1 Oct 2018 21:01:59 +0100 Subject: [PATCH] Fix failure to close the outgoing socket. A second bug in the area of clean SSH-connection closure: I was setting the pending_close flag (formerly send_outgoing_eof) and expecting that once the outgoing backlog was cleared it would cause a socket closure. But of course the function that does that - ssh_bpp_output_raw_data_callback() - will only get called if there _is_ any outgoing backlog to be cleared! So if there was already no backlog, I would set the pending_close flag and nothing would ever check it again. Fixed by manually re-queuing the callback that will check the backlog and the pending_close flag. --- ssh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ssh.c b/ssh.c index 48af9e78..f4468d6b 100644 --- a/ssh.c +++ b/ssh.c @@ -373,6 +373,7 @@ static void ssh_initiate_connection_close(Ssh ssh) * schedule closing the network socket after they go out. */ ssh_bpp_handle_output(ssh->bpp); ssh->pending_close = TRUE; + queue_idempotent_callback(&ssh->ic_out_raw); /* Now we expect the other end to close the connection too in * response, so arrange that we'll receive notification of that