Skip to content
Snippets Groups Projects
Commit 36750b84 authored by David Galeano's avatar David Galeano Committed by Andy Green
Browse files

Return NULL if the handshake failed to complete,

libwebsocket_service_fd closes and frees the websocket in that case.
parent a3a97d1a
Branches
Tags
No related merge requests found
...@@ -138,9 +138,15 @@ struct libwebsocket *__libwebsocket_client_connect_2( ...@@ -138,9 +138,15 @@ struct libwebsocket *__libwebsocket_client_connect_2(
wsi->mode = LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE; wsi->mode = LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE;
pfd.fd = wsi->sock; pfd.fd = wsi->sock;
pfd.revents = POLLIN; pfd.revents = POLLIN;
if (libwebsocket_service_fd(context, &pfd) < 0)
n = libwebsocket_service_fd(context, &pfd);
if (n < 0)
goto oom4; goto oom4;
if (n) /* returns 1 on failure after closing wsi */
return NULL;
return wsi; return wsi;
oom4: oom4:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment