[Libwebsockets] lwsws and plugins on master

Martin Labonté martin.labonte at sympatico.ca
Thu Apr 7 05:51:04 CEST 2016


Hello all,

I'm trying a modified test-echo using libuv on Windows. Once this will work, 
I will add another tcp socket (not a websocket) that will be managed by the 
libuv event loop. You can see below the changes I had to do but it's still 
not working. I can connect and disconnect my browser to the server but when 
I send a message, nothing happen. Is there something obvious I miss? I'm new 
to libwebsocket and libuv. I'm using libuv 1.8.

Thanks,

Martin

--------------------------------------------------------------
$ git diff --cached lib/libuv.c
diff --git a/lib/libuv.c b/lib/libuv.c
index 2870316..0e60d4d 100644
--- a/lib/libuv.c
+++ b/lib/libuv.c
@@ -245,7 +245,7 @@ lws_libuv_accept(struct lws *wsi, int accept_fd)

        wsi->w_read.context = context;

-       uv_poll_init(pt->io_loop_uv, &wsi->w_read.uv_watcher, accept_fd);
+       uv_poll_init_socket(pt->io_loop_uv, &wsi->w_read.uv_watcher, 
accept_fd);
}
--------------------------------------------------------------
diff --git a/test-server/test-echo.c b/test-server/test-echo.c
index 6c1729e..c71178d 100644
--- a/test-server/test-echo.c
+++ b/test-server/test-echo.c
@@ -106,7 +106,7 @@ do_rx:
                          len, pss->final, (int)pss->len);

                memcpy(&pss->buf[LWS_PRE], in, len);
-               assert((int)pss->len == -1);
+               //assert((int)pss->len == -1);
                pss->len = (unsigned int)len;
                pss->rx += len;

@@ -241,7 +241,7 @@ int main(int argc, char **argv)
        int port = 7681;
        int use_ssl = 0;
        struct lws_context *context;
-       int opts = 0;
+       int opts = LWS_SERVER_OPTION_LIBUV;
        char interface_name[128] = "";
        const char *_interface = NULL;
        char ssl_cert[256] = 
LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
@@ -448,7 +448,12 @@ int main(int argc, char **argv)
                return -1;
        }

+       lws_uv_initloop(context, NULL, sighandler, 0);
+
+
+       lws_libuv_run(context, 0);

+       // Unreachable code from here if no interrupt
        signal(SIGINT, sighandler);

#ifndef LWS_NO_CLIENT
--------------------------------------------------------------




More information about the Libwebsockets mailing list