From 19a4995d0842b33ae79553043fa99f526ee13ff5 Mon Sep 17 00:00:00 2001 From: cy384 Date: Thu, 25 Jun 2020 21:06:19 -0400 Subject: [PATCH] improve connection shutdown handling --- ssheven.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ssheven.c b/ssheven.c index 37ae892..ab9bb70 100644 --- a/ssheven.c +++ b/ssheven.c @@ -21,7 +21,8 @@ // functions to convert error and status codes to strings #include "ssheven-debug.h" -#define SSHEVEN_VERSION "0.0.0" +// version string +#define SSHEVEN_VERSION "0.0.1" // network buffer size enum { buffer_size = 4096 }; @@ -171,11 +172,21 @@ void do_ssh_connection(char* hostname, char* username, char* password, char* com OTRcvDisconnect(endpoint, nil); break; + case T_ORDREL: + err = OTRcvOrderlyDisconnect(endpoint); + if (err == noErr) + { + err = OTSndOrderlyDisconnect(endpoint); + } + break; + default: - printf("unexpected OTLook result while closing: %d\n", result); + printf("unexpected OTLook result while closing: %s\n", OT_event_string(result)); break; } + + OT_cleanup: // release endpoint