mirror of
https://github.com/libssh2/libssh2.git
synced 2026-10-24 03:48:58 +03:00
@@ -337,6 +337,18 @@ static int port_from_container(char *container_id, char **port_out)
|
||||
}
|
||||
}
|
||||
|
||||
static void close_socket_to_container(libssh2_socket_t sock)
|
||||
{
|
||||
if(sock != LIBSSH2_INVALID_SOCKET) {
|
||||
shutdown(sock, 2 /* SHUT_RDWR */);
|
||||
#ifdef _WIN32
|
||||
closesocket(sock);
|
||||
#else
|
||||
close(sock);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static libssh2_socket_t open_socket_to_container(char *container_id)
|
||||
{
|
||||
char *ip_address = NULL;
|
||||
@@ -416,6 +428,7 @@ static libssh2_socket_t open_socket_to_container(char *container_id)
|
||||
}
|
||||
}
|
||||
if(ret == LIBSSH2_INVALID_SOCKET) {
|
||||
close_socket_to_container(sock);
|
||||
fprintf(stderr, "Failed to connect to %s:%s\n",
|
||||
ip_address, port_string);
|
||||
goto cleanup;
|
||||
@@ -428,18 +441,6 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void close_socket_to_container(libssh2_socket_t sock)
|
||||
{
|
||||
if(sock != LIBSSH2_INVALID_SOCKET) {
|
||||
shutdown(sock, 2 /* SHUT_RDWR */);
|
||||
#ifdef _WIN32
|
||||
closesocket(sock);
|
||||
#else
|
||||
close(sock);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static char *running_container_id = NULL;
|
||||
|
||||
int start_openssh_fixture(void)
|
||||
|
||||
Reference in New Issue
Block a user