mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-23 01:22:37 +03:00
session_disconnect: clear state
If authentication is started but not completed before the application gives up and instead wants to shut down the session, the '->state' field might still be set and thus effectively dead-lock session_disconnect. This happens because both _libssh2_transport_send() and _libssh2_transport_read() refuse to do anything as long as state is set without the LIBSSH2_STATE_KEX_ACTIVE bit. Reported in curl bug https://github.com/curl/curl/issues/3650 Closes #310
This commit is contained in:
@@ -1161,7 +1161,7 @@ libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason,
|
|||||||
const char *desc, const char *lang)
|
const char *desc, const char *lang)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
session->state = 0;
|
||||||
BLOCK_ADJUST(rc, session,
|
BLOCK_ADJUST(rc, session,
|
||||||
session_disconnect(session, reason, desc, lang));
|
session_disconnect(session, reason, desc, lang));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user