1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

libuv: use shadow active events mask

libuv .events or .pevents in the io watcher don't seem to hold the POLLIN / POLLOUT
state correctly.  When POLLIN is defeated, using the rx flow control, POLLOUT seems
to go away somewhere along the line when trying to OR on to the active mask.

This has us track what we enabled outside in a container struct and use that for
the mask instead.  With this rx flow control works properly with the latest mirror
using libuv (it worked fine with poll() event loop without libuv).
This commit is contained in:
Andy Green 2017-09-25 11:54:00 +08:00
parent bc451afb30
commit 495342c2ae
2 changed files with 10 additions and 7 deletions

View file

@ -338,14 +338,13 @@ lws_libuv_io(struct lws *wsi, int flags)
{
struct lws_context *context = lws_get_context(wsi);
struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
#if defined(WIN32) || defined(_WIN32)
int current_events = wsi->w_read.uv_watcher.events &
(UV_READABLE | UV_WRITABLE);
#else
int current_events = wsi->w_read.uv_watcher.io_watcher.pevents &
(UV_READABLE | UV_WRITABLE);
#endif
struct lws_io_watcher *w = &wsi->w_read;
//#if defined(WIN32) || defined(_WIN32)
// int current_events = w->uv_watcher.events &
// (UV_READABLE | UV_WRITABLE);
//#else
int current_events = w->actual_events & (UV_READABLE | UV_WRITABLE);
//#endif
if (!LWS_LIBUV_ENABLED(context))
return;
@ -384,6 +383,8 @@ lws_libuv_io(struct lws *wsi, int flags)
uv_poll_start(&w->uv_watcher, current_events,
lws_io_cb);
}
w->actual_events = current_events;
}
int

View file

@ -696,6 +696,8 @@ struct lws_io_watcher {
struct event *event_watcher;
#endif
struct lws_context *context;
uint8_t actual_events;
};
struct lws_signal_watcher {