1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-05 21:42:47 -05:00

Packet protocol layers: new 'final_output' method.

This is called just before closing the connection, and gives every PPL
one last chance to output anything to the user that it might have
buffered.

No functional change: all implementations so far are trivial, except
that the transport layer passes the call on to its higher
layer (because otherwise nothing would do so).

(cherry picked from commit d6e6919f69)
This commit is contained in:
Simon Tatham
2023-04-29 11:35:20 +01:00
parent 7e8be5a204
commit 44272b5355
10 changed files with 36 additions and 0 deletions

View File

@ -474,6 +474,8 @@ void ssh_remote_error(Ssh *ssh, const char *fmt, ...)
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
ssh_ppl_final_output(ssh->base_layer);
/* Error messages sent by the remote don't count as clean exits */
ssh->exitcode = 128;
@ -492,6 +494,8 @@ void ssh_remote_eof(Ssh *ssh, const char *fmt, ...)
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
ssh_ppl_final_output(ssh->base_layer);
/* EOF from the remote, if we were expecting it, does count as
* a clean exit */
ssh->exitcode = 0;
@ -515,6 +519,8 @@ void ssh_proto_error(Ssh *ssh, const char *fmt, ...)
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
ssh_ppl_final_output(ssh->base_layer);
ssh->exitcode = 128;
ssh_bpp_queue_disconnect(ssh->bpp, msg,
@ -532,6 +538,8 @@ void ssh_sw_abort(Ssh *ssh, const char *fmt, ...)
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
ssh_ppl_final_output(ssh->base_layer);
ssh->exitcode = 128;
ssh_initiate_connection_close(ssh);
@ -549,6 +557,8 @@ void ssh_user_close(Ssh *ssh, const char *fmt, ...)
if (ssh->base_layer || !ssh->session_started) {
GET_FORMATTED_MSG;
ssh_ppl_final_output(ssh->base_layer);
/* Closing the connection due to user action, even if the
* action is the user aborting during authentication prompts,
* does count as a clean exit - except that this is also how