diff options
author | Meir Yanovich <meiry@github.invalid.com> | 2016-04-05 07:31:16 +0800 |
---|---|---|
committer | Andy Green <andy@warmcat.com> | 2016-04-05 07:31:16 +0800 |
commit | b1f80eeeb71fcae7a4359292ee97563c68a7dad3 (patch) | |
tree | e284e666462126e136b5ac31b102caf98cc72aa9 | |
parent | 934cc80d95a3ae321e894cca8fc20e0fb85ce8f6 (diff) | |
download | libwebsockets-b1f80eeeb71fcae7a4359292ee97563c68a7dad3.tar.gz libwebsockets-b1f80eeeb71fcae7a4359292ee97563c68a7dad3.tar.bz2 libwebsockets-b1f80eeeb71fcae7a4359292ee97563c68a7dad3.zip |
libuv win32 fixes 2
https://github.com/warmcat/libwebsockets/issues/411#issuecomment-204284368
-rw-r--r-- | lib/libuv.c | 7 | ||||
-rw-r--r-- | test-server/test-server-libuv.c | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/libuv.c b/lib/libuv.c index d86d43bf..6e7038ba 100644 --- a/lib/libuv.c +++ b/lib/libuv.c @@ -39,7 +39,7 @@ lws_io_cb(uv_poll_t *watcher, int status, int revents) struct lws_pollfd eventfd; #if defined(WIN32) || defined(_WIN32) - eventfd.fd = watcher->sock; + eventfd.fd = watcher->socket; #else eventfd.fd = watcher->io_watcher.fd; #endif @@ -151,9 +151,10 @@ lws_uv_initloop(struct lws_context *context, uv_loop_t *loop, uv_signal_cb cb, * We have to do it here because the uv loop(s) are not * initialized until after context creation. */ + if (wsi) { wsi->w_read.context = context; - uv_poll_init(pt->io_loop_uv, &wsi->w_read.uv_watcher, + uv_poll_init_socket(pt->io_loop_uv, &wsi->w_read.uv_watcher, pt->lserv_fd); uv_poll_start(&wsi->w_read.uv_watcher, UV_READABLE, lws_io_cb); @@ -226,7 +227,7 @@ 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.io.events & + 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 & diff --git a/test-server/test-server-libuv.c b/test-server/test-server-libuv.c index b6ef5282..4268c4e1 100644 --- a/test-server/test-server-libuv.c +++ b/test-server/test-server-libuv.c @@ -227,7 +227,8 @@ int main(int argc, char **argv) } } -#if !defined(LWS_NO_DAEMONIZE) && !defined(WIN32) +#if !defined(WIN32) +#if !defined(LWS_NO_DAEMONIZE) /* * normally lock path would be /var/lock/lwsts or similar, to * simplify getting started without having to take care about @@ -242,6 +243,7 @@ int main(int argc, char **argv) /* we will only try to log things according to our debug_level */ setlogmask(LOG_UPTO (LOG_DEBUG)); openlog("lwsts", syslog_options, LOG_DAEMON); +#endif /* tell the library what debug level to emit and to send it to syslog */ lws_set_log_level(debug_level, lwsl_emit_syslog); |