Post disconnect event and free context before returning from ssh2_thread()

This commit is contained in:
Brendan Shanks 2017-08-06 23:39:21 -07:00
parent 3b7054c2fc
commit d81f76338c
1 changed files with 23 additions and 0 deletions

View File

@ -1668,6 +1668,29 @@ closesocket:
} }
done: done:
/* disconnect indication */
if ( port != -1 ) {
netputevent(CONCLASS, CONCLOSE, port, 0);
}
/* window's ptr might have changed... better reload it */
w = ssh2_window();
if ( w ) {
if ( w->sshdata.thread == pthread_self() ) {
w->sshdata.thread = NULL;
w->sshdata.context = NULL;
}
}
if ( context ) {
if ( context->_listener != -1 ) {
listener = context->_listener;
context->_listener = -1;
close( listener );
}
context->_self = NULL;
DisposePtr((Ptr)context);
}
return NULL; return NULL;
#if 0 #if 0