Return NULL if the handshake failed to complete,
libwebsocket_service_fd closes and frees the websocket in that case.
This commit is contained in:
parent
a3a97d1acc
commit
36750b84fd
1 changed files with 7 additions and 1 deletions
|
@ -138,9 +138,15 @@ struct libwebsocket *__libwebsocket_client_connect_2(
|
|||
wsi->mode = LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE;
|
||||
pfd.fd = wsi->sock;
|
||||
pfd.revents = POLLIN;
|
||||
if (libwebsocket_service_fd(context, &pfd) < 0)
|
||||
|
||||
n = libwebsocket_service_fd(context, &pfd);
|
||||
|
||||
if (n < 0)
|
||||
goto oom4;
|
||||
|
||||
if (n) /* returns 1 on failure after closing wsi */
|
||||
return NULL;
|
||||
|
||||
return wsi;
|
||||
|
||||
oom4:
|
||||
|
|
Loading…
Add table
Reference in a new issue