[Libwebsockets] SegFault for Websocket Server on Multiple Network Interface

techi eth techieth at gmail.com
Tue Jul 18 06:50:05 CEST 2017


Test Server as it works perfectly. As mentioned earlier for single
interface test stuff is working ok but when you have two interface there is
problem.



I have tried as suggested by you for destroying vhost not in callback but
still issue persist. Please find attached modified patch for test server.




On Mon, Jul 17, 2017 at 10:54 PM, Andy Green <andy at warmcat.com> wrote:

>
>
> On 07/17/2017 08:26 PM, techi eth wrote:
>
>> Please find attached patch over test_server.Base test server code work
>> fine with one interface but with two interface i am seeing problem.
>> Please check attached patch & point me for issue.I have run below command
>> to start test server.
>>
>
> It's good to know if the test server works OK for you as-is.
>
> Destroying the vhost during service is probably going to make trouble,
> because the caller may hold pointers to it if nothing else.
>
> +               case LWS_CALLBACK_ESTABLISHED :
> +                       lws_get_peer_simple(wsi,IPAddrBuf,32);
> +                       printf ("fWebsocketWrapServer1CB :
> LWS_CALLBACK_ESTABLISHED,Client IP=%s,Socket ID
> =%d\n",IPAddrBuf,lws_get_socket_fd(wsi));
> +                       printf("Calling LWS VHOST DESTROY\n");
> +                       lws_vhost_destroy(vhost1);
>
> Why don't you follow what the test server does and create and destroy the
> vhosts outside of the service.
>
> -               if (dynamic_vhost_enable && !dynamic_vhost) {
> -                       lwsl_notice("creating dynamic vhost...\n");
> -                       dynamic_vhost = lws_create_vhost(context, &info);
> -               } else
> -                       if (!dynamic_vhost_enable && dynamic_vhost) {
> -                               lwsl_notice("destroying dynamic
> vhost...\n");
> -                               lws_vhost_destroy(dynamic_vhost);
> -                               dynamic_vhost = NULL;
> -                       }
> +//             if (dynamic_vhost_enable && !dynamic_vhost) {
> +//                     lwsl_notice("creating dynamic vhost...\n");
> +//                     dynamic_vhost = lws_create_vhost(context, &info);
> +//             } else
> +//                     if (!dynamic_vhost_enable && dynamic_vhost) {
> +//                             lwsl_notice("destroying dynamic
> vhost...\n");
> +//                             lws_vhost_destroy(dynamic_vhost);
> +//                             dynamic_vhost = NULL;
> +//
>
> -Andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170718/34b5cf5c/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libwebsocket_test_server_vhost_destroy_issue.patch
Type: application/octet-stream
Size: 10306 bytes
Desc: not available
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170718/34b5cf5c/attachment-0002.obj>


More information about the Libwebsockets mailing list