mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
Fix broken libev support in client mode
Maybe it will be better to move all lws_libev_io() inside lws_change_pollfd() to avoid similar problems in future. The same for lws_libev_accept() and insert_wsi_socket_into_fds().
This commit is contained in:
parent
40d5abc2aa
commit
20636ec970
2 changed files with 9 additions and 7 deletions
|
@ -151,6 +151,7 @@ struct libwebsocket *libwebsocket_client_connect_2(
|
|||
|
||||
wsi->mode = LWS_CONNMODE_WS_CLIENT_WAITING_CONNECT;
|
||||
|
||||
lws_libev_accept(context, wsi, wsi->sock);
|
||||
insert_wsi_socket_into_fds(context, wsi);
|
||||
|
||||
libwebsocket_set_timeout(wsi,
|
||||
|
@ -212,6 +213,7 @@ struct libwebsocket *libwebsocket_client_connect_2(
|
|||
*/
|
||||
if (lws_change_pollfd(wsi, 0, LWS_POLLOUT))
|
||||
goto oom4;
|
||||
lws_libev_io(context, wsi, LWS_EV_START | LWS_EV_WRITE);
|
||||
|
||||
return wsi;
|
||||
}
|
||||
|
|
|
@ -274,6 +274,13 @@ lws_plat_drop_app_privileges(struct lws_context_creation_info *info)
|
|||
LWS_VISIBLE int
|
||||
lws_plat_init_fd_tables(struct libwebsocket_context *context)
|
||||
{
|
||||
context->fd_random = open(SYSTEM_RANDOM_FILEPATH, O_RDONLY);
|
||||
if (context->fd_random < 0) {
|
||||
lwsl_err("Unable to open random device %s %d\n",
|
||||
SYSTEM_RANDOM_FILEPATH, context->fd_random);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (lws_libev_init_fd_table(context))
|
||||
/* libev handled it instead */
|
||||
return 0;
|
||||
|
@ -289,13 +296,6 @@ lws_plat_init_fd_tables(struct libwebsocket_context *context)
|
|||
context->fds[0].revents = 0;
|
||||
context->fds_count = 1;
|
||||
|
||||
context->fd_random = open(SYSTEM_RANDOM_FILEPATH, O_RDONLY);
|
||||
if (context->fd_random < 0) {
|
||||
lwsl_err("Unable to open random device %s %d\n",
|
||||
SYSTEM_RANDOM_FILEPATH, context->fd_random);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue