mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
cancel pipes: treat nonzero return code from platform only as indication not to use dummy_pipe_fds
https://github.com/warmcat/libwebsockets/issues/1291
This commit is contained in:
parent
0f9c75f6b5
commit
9488424b8d
1 changed files with 13 additions and 8 deletions
|
@ -988,24 +988,29 @@ lws_create_event_pipes(struct lws_context *context)
|
|||
wsi->tsi = n;
|
||||
wsi->vhost = NULL;
|
||||
wsi->event_pipe = 1;
|
||||
wsi->desc.sockfd = LWS_SOCK_INVALID;
|
||||
context->pt[n].pipe_wsi = wsi;
|
||||
context->count_wsi_allocated++;
|
||||
|
||||
if (lws_plat_pipe_create(wsi)) {
|
||||
lws_free(wsi);
|
||||
if (lws_plat_pipe_create(wsi))
|
||||
/*
|
||||
* platform code returns 0 if it actually created pipes
|
||||
* and initialized pt->dummy_pipe_fds[]. If it used
|
||||
* some other mechanism outside of signaling in the
|
||||
* normal event loop, we skip treating the pipe as
|
||||
* related to dummy_pipe_fds[], adding it to the fds,
|
||||
* etc.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
wsi->desc.sockfd = context->pt[n].dummy_pipe_fds[0];
|
||||
lwsl_debug("event pipe fd %d\n", wsi->desc.sockfd);
|
||||
|
||||
context->pt[n].pipe_wsi = wsi;
|
||||
|
||||
if (context->event_loop_ops->accept)
|
||||
context->event_loop_ops->accept(wsi);
|
||||
|
||||
if (__insert_wsi_socket_into_fds(context, wsi))
|
||||
return 1;
|
||||
|
||||
//lws_change_pollfd(context->pt[n].pipe_wsi, 0, LWS_POLLIN);
|
||||
context->count_wsi_allocated++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue