Commit 17339cb34af32abd68cf474da67de6c2e99ae43c

Edward Thomson 2018-04-16T15:35:56

Merge pull request #4596 from pks-t/pks/ssh-disconnect transports: ssh: disconnect session before freeing it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/transports/ssh.c b/src/transports/ssh.c
index dcd9b5e..23c6433 100644
--- a/src/transports/ssh.c
+++ b/src/transports/ssh.c
@@ -212,6 +212,7 @@ static void ssh_stream_free(git_smart_subtransport_stream *stream)
 	}
 
 	if (s->session) {
+		libssh2_session_disconnect(s->session, "closing transport");
 		libssh2_session_free(s->session);
 		s->session = NULL;
 	}
@@ -489,7 +490,7 @@ static int _git_ssh_session_create(
 	}
 
 	do {
-		rc = libssh2_session_startup(s, socket->s);
+		rc = libssh2_session_handshake(s, socket->s);
 	} while (LIBSSH2_ERROR_EAGAIN == rc || LIBSSH2_ERROR_TIMEOUT == rc);
 
 	if (rc != LIBSSH2_ERROR_NONE) {