diff options
author | Tobias Maier <tobias.maier@netplace.com> | 2012-05-30 12:46:42 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2012-05-30 12:46:42 +0800 |
commit | d1db83c6508e2a856156e2500def5392a9a6d788 (patch) | |
tree | c44a5507afb23ba82daaa73ac00fa43410c9c437 | |
parent | e59d477c078f40a0755ac9897e121f3a7fbb7fdd (diff) |
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>
-rw-r--r-- | lib/client-handshake.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/client-handshake.c b/lib/client-handshake.c index f8d0b69..d3d3daa 100644 --- a/lib/client-handshake.c +++ b/lib/client-handshake.c @@ -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; } |