<div dir="ltr">Sure,i will check after debugging.<div><br></div><div>Could you please let me know what is use of deferred destroy after 5 second.I was seeing problem if i have network glitch.</div><div><br></div><div>Thanks</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 10, 2017 at 3:22 PM, Andy Green <span dir="ltr"><<a href="mailto:andy@warmcat.com" target="_blank">andy@warmcat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 11/10/2017 05:46 PM, Vijay Khurdiya wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
OK, Thanks.<br>
<br>
I am having different server started on different network interface on port 443. (Ex : eth0,wlan0,wlan1).By looking code snippet you have shared or from git repo i couldn't figure out if i will give different vhost name than it will not match the condition.<br>
</blockquote>
<br></span>
You should give a unique vhost name anyway.  Because logging uses the vhost name in a lot of places, if you hope to learn something more specific than default / default / default why not give them each a name like "wlan0" that is easy to see what is going on?<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Please let me know if i am missing something to understand.<br>
<br>
in this case if i tried to created again vhost than i am getting return NULL,which means vhost creation failed.<br>
</blockquote>
<br></span>
So... why don't you debug it and send me a patch, or let me know the problem more precisely that just "why doesn't this work"?<br>
<br>
-Andy<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
On Fri, Nov 10, 2017 at 3:05 PM, Andy Green <<a href="mailto:andy@warmcat.com" target="_blank">andy@warmcat.com</a> <mailto:<a href="mailto:andy@warmcat.com" target="_blank">andy@warmcat.com</a>>> wrote:<br>
<br>
<br>
<br>
    On 11/10/2017 05:21 PM, Vijay Khurdiya wrote:<br>
<br>
        I am creating two server in different interface but i haven't<br>
        given any specific vhost name.<br>
        Do you see this issue due to not giving vhost name.<br>
<br>
<br>
    Yes.  Give an info.vhost_name that is unique.<br>
<br>
    The vhost_name is also used to sort out when multiple vhosts bind to<br>
    the same socket... the vhost name should reflect the external DNS name.<br>
<br>
    For example <a href="https://warmcat.com" rel="noreferrer" target="_blank">https://warmcat.com</a> and <a href="https://libwebsockets.org" rel="noreferrer" target="_blank">https://libwebsockets.org</a> are<br>
    actually running on the same machine on the same lwsws instance both<br>
    on :443, but there are different vhosts defined named "<a href="http://warmcat.com" rel="noreferrer" target="_blank">warmcat.com</a><br></span>
    <<a href="http://warmcat.com" rel="noreferrer" target="_blank">http://warmcat.com</a>>" and "<a href="http://libwebsockets.org" rel="noreferrer" target="_blank">libwebsockets.org</a><br>
    <<a href="http://libwebsockets.org" rel="noreferrer" target="_blank">http://libwebsockets.org</a>>".  lws uses SNI to figure out which TLS<span class=""><br>
    cert to give you and which vhost to bind to depending on what you<br>
    told your browser.<br>
<br>
        I also not getting in what case it can happen ??<br>
<br>
<br>
    At least giving unique vhost names is going to stop the related<br>
    diagnostic messages being a bunch of mush, right :-)<br>
<br>
    -Andy<br>
<br>
<br>
        On Fri, Nov 10, 2017 at 2:39 PM, Andy Green <<a href="mailto:andy@warmcat.com" target="_blank">andy@warmcat.com</a><br></span>
        <mailto:<a href="mailto:andy@warmcat.com" target="_blank">andy@warmcat.com</a>> <mailto:<a href="mailto:andy@warmcat.com" target="_blank">andy@warmcat.com</a><div><div class="h5"><br>
        <mailto:<a href="mailto:andy@warmcat.com" target="_blank">andy@warmcat.com</a>>>> wrote:<br>
<br>
<br>
<br>
             On 11/10/2017 04:43 PM, Vijay Khurdiya wrote:<br>
<br>
                 I am observing one issue when I tried to do<br>
        lws_vhost_destroy()<br>
                 following lws_vhost_create().<br>
<br>
                 I found vhost destroy is not happening completely I am<br>
        getting<br>
                 below log.<br>
<br>
                 lws_vhost_destroy1: listen skt from default to default<br>
<br>
                 After that if I try to create vhost than I am getting<br>
        below error.<br>
<br>
                 [2017/11/09 09:39:52:2245] NOTICE: Creating Vhost<br>
        'default' port<br>
                 443, 1 protocols, IPv6 off<br>
<br>
                 [2017/11/09 09:39:52:2279] ERR: ERROR on binding fd 21<br>
        to port<br>
                 443 (-1 98)<br>
<br>
                 [2017/11/09 09:39:52:2283] ERR: init server failed<br>
<br>
                 [2017/11/09 09:39:52:2751] NOTICE: Creating Vhost<br>
        'default' port<br>
                 443, 1 protocols, IPv6 off<br>
<br>
                 [2017/11/09 09:39:52:2872] ERR: ERROR on binding fd 21<br>
        to port<br>
                 443 (-1 98)<br>
<br>
                 [2017/11/09 09:39:52:2877] ERR: init server failed<br>
<br>
                 Could you please give me hint in what I case this can<br>
        occur.<br>
<br>
<br>
             Hm... the code looks like this<br>
<br>
                      vh->being_destroyed = 1;<br>
<br>
                      /*<br>
                       * Are there other vhosts that are piggybacking on our<br>
             listen socket?<br>
                       * If so we need to hand the listen socket off to<br>
        one of<br>
             the others<br>
                       * so it will remain open.  If not, leave it<br>
        attached to<br>
             the closing<br>
                       * vhost and it will get closed.<br>
                       */<br>
<br>
                      if (vh->lserv_wsi)<br>
                              lws_start_foreach_ll(struct lws_vhost *, v,<br>
                                                   context->vhost_list) {<br>
                                      if (v != vh &&<br>
                                          !v->being_destroyed &&<br>
                                          v->listen_port ==<br>
        vh->listen_port &&<br>
                                          ((!v->iface && !vh->iface) ||<br>
                                          (v->iface && vh->iface &&<br>
                                          !strcmp(v->iface, vh->iface)))) {<br>
                                              /*<br>
                                               * this can only be a<br>
        listen wsi,<br>
             which is<br>
                                               * restricted... it has no<br>
        protocol<br>
             or other<br>
                                               * bindings or states.  So<br>
        we can<br>
             simply<br>
                                               * swap it to a vhost that<br>
        has the same<br>
                                               * iface + port, but is<br>
        not closing.<br>
                                               */<br>
                                              assert(v->lserv_wsi == NULL);<br>
                                              v->lserv_wsi = vh->lserv_wsi;<br>
                                              vh->lserv_wsi = NULL;<br>
                                              if (v->lserv_wsi)<br>
                                                             v->lserv_wsi->vhost = v;<br>
<br>
                                              lwsl_notice("%s: listen<br>
        skt from %s<br>
             to %s\n",<br>
                                                          __func__,<br>
        vh->name,<br>
             v->name);<br>
                                              break;<br>
                                      }<br>
                              } lws_end_foreach_ll(v, vhost_next);<br>
<br>
<br>
             but it says<br>
<br>
             listen skt from default to default<br>
<br>
             have you possibly created more than one vhost called "default"?<br>
<br>
             -Andy<br>
<br>
<br>
<br>
                 ______________________________<wbr>_________________<br>
                 Libwebsockets mailing list<br>
        <a href="mailto:Libwebsockets@ml.libwebsockets.org" target="_blank">Libwebsockets@ml.libwebsockets<wbr>.org</a><br>
        <mailto:<a href="mailto:Libwebsockets@ml.libwebsockets.org" target="_blank">Libwebsockets@ml.libwe<wbr>bsockets.org</a>><br></div></div>
                 <mailto:<a href="mailto:Libwebsockets@ml.libwebsockets.org" target="_blank">Libwebsockets@ml.libwe<wbr>bsockets.org</a><span class=""><br>
        <mailto:<a href="mailto:Libwebsockets@ml.libwebsockets.org" target="_blank">Libwebsockets@ml.libwe<wbr>bsockets.org</a>>><br>
        <a href="https://libwebsockets.org/mailman/listinfo/libwebsockets" rel="noreferrer" target="_blank">https://libwebsockets.org/mail<wbr>man/listinfo/libwebsockets</a><br>
        <<a href="https://libwebsockets.org/mailman/listinfo/libwebsockets" rel="noreferrer" target="_blank">https://libwebsockets.org/mai<wbr>lman/listinfo/libwebsockets</a>><br></span>
                        <<a href="https://libwebsockets.org/mailman/listinfo/libwebsockets" rel="noreferrer" target="_blank">https://libwebsockets.org/mai<wbr>lman/listinfo/libwebsockets</a><br>
        <<a href="https://libwebsockets.org/mailman/listinfo/libwebsockets" rel="noreferrer" target="_blank">https://libwebsockets.org/mai<wbr>lman/listinfo/libwebsockets</a>>><br>
<br>
<br>
<br>
</blockquote>
</blockquote></div><br></div>