1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

sockets were left open if connection could not be

established resulting in a mass of unusable open file
 descriptors

Signed-off-by: Tobias Maier <tobias.maier@netplace.com>
This commit is contained in:
Tobias Maier 2012-05-30 12:46:42 +08:00 committed by Andy Green
parent e59d477c07
commit d1db83c650

View file

@ -80,6 +80,11 @@ struct libwebsocket *__libwebsocket_client_connect_2(
if (connect(wsi->sock, (struct sockaddr *)&server_addr,
sizeof(struct sockaddr)) == -1) {
fprintf(stderr, "Connect failed\n");
#ifdef WIN32
closesocket(wsi->sock);
#else
close(wsi->sock);
#endif
goto oom4;
}