improve connection shutdown handling

This commit is contained in:
cy384 2020-06-25 21:06:19 -04:00
parent 46e6675afe
commit 19a4995d08
1 changed files with 13 additions and 2 deletions

View File

@ -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