[Libwebsockets] lwsws and plugins on master

Andy Green andy at warmcat.com
Fri Apr 8 06:06:38 CEST 2016



On 04/08/2016 11:53 AM, Martin Labonté wrote:
> Thanks Andy,
>
> I think even libwebsockets-test-server-libuv is not working properly. I get
>
> [2016/03/07 23:26:57:4937] NOTICE: wsi 00C9FE28: TIMEDOUT WAITING on 3
> (did hdr 0, ah 00000000, wl 0, pfd events 0)
>
> Do you think there is someone else in the libwebsocket community that is
> building with libuv and Visual Studio? I saw you made some fixes for
> Windows but I think it's not your first choice as development platform. ;-)

In fact I haven't used windows for development since 2002 or so.

Lws is written for Linux but over the years, at intervals some dozens of 
people have appeared with patches to keep stuff working on windows.  The 
last big effort was just before 1.7 release.

However new features (libuv appeared right at the end of 1.7 release) 
are only tested on Linux by me.  We'll be in a similar situation next 
release with new features like lwsws plugins and dirent.h, microsoft 
decided to not provide dirent.h with their platform and plugins need to 
be done differently on windows.  I am philosophically disinclined to get 
into that for a few reasons.  So those features won't be available on 
windows until someone ports the Linux implementations.

The platform-specific stuff is separated out into platform-specific .c 
files to make it easier, but the fact is there's no resident windows guy 
on this project, until now no user cares enough to stick around and keep 
it working for others.

> I will try to compare the behavior on linux with libuv but I have no
> development setup for Linux... only Docker.

On Linux it just works.... in fact the new lwsws feature coming next 
release depends on libuv.  There was a guy on github recently who 
generated the last libuv patches, make sure you are using current master

https://github.com/warmcat/libwebsockets/issues/411

it appears to work OK for him on windows after the fixes.

-Andy

> Regards,
>
> Martin
>
> -----Message d'origine----- From: Andy Green
> Sent: Thursday, April 7, 2016 12:11 AM
> To: Martin Labonté ; libwebsockets at ml.libwebsockets.org
> Subject: Re: [Libwebsockets] lwsws and plugins on master
>
> On 04/07/2016 11:51 AM, Martin Labonté wrote:
>> 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.
>
> Did you try libwebsockets-test-server-libuv?  That should work out of
> the box.
>
> Compare the differences between test-server.c and test-server-libuv.c to
> see how to adapt the echo server.
>
> -Andy
>
>>
>> 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
>> --------------------------------------------------------------
>>
>> _______________________________________________
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
>> http://libwebsockets.org/mailman/listinfo/libwebsockets
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets



More information about the Libwebsockets mailing list