<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I am using libwebsockets on Windows 7 in external poll mode.  <br>
    I am finding that if I present a socket fd on a normal HTTP
    connection (LWS_CONNMODE_HTTP_SERVING:) to libwebsocket_service_fd
    with just a HUP event, the event doesn't get handled but revents
    gets cleared indicating that the event has been handled.  Should it
    be handled in the same way as LWS_CONNMODE_WS_SERVING?<br>
    Maybe like this?<br>
    <br>
    <tt>    /* okay, what we came here to do... */</tt><tt><br>
    </tt><tt><br>
    </tt><tt>    switch (wsi->mode) {</tt><tt><br>
    </tt><tt><br>
    </tt><tt>#ifndef LWS_NO_SERVER</tt><tt><br>
    </tt><tt>    case LWS_CONNMODE_HTTP_SERVING:</tt><tt><br>
    </tt><tt>    case LWS_CONNMODE_HTTP_SERVING_ACCEPTED:</tt><tt><br>
    </tt><tt>    case LWS_CONNMODE_SERVER_LISTENER:</tt><tt><br>
    </tt><tt>    case LWS_CONNMODE_SSL_ACK_PENDING:</tt><tt><br>
              /*** Inserted ************************************/<br>
    </tt><tt><tt>        if ((!(pollfd->revents & POLLIN))
        &&</tt><tt><br>
      </tt><tt>                (pollfd->revents & (POLLERR |
        POLLHUP))) {</tt><tt><br>
      </tt><tt><br>
      </tt><tt>            lwsl_debug("Session Socket %p (fd=%d)
        dead\n",</tt><tt><br>
      </tt><tt>                (void *)wsi, pollfd->fd);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>            goto close_and_handled;</tt><tt><br>
      </tt><tt>        }<br>
                /*************************************************/<br>
      </tt>
              n = lws_server_socket_service(context, wsi, pollfd);</tt><tt><br>
    </tt><tt>        goto handled;</tt><tt><br>
    </tt><tt>#endif</tt><tt><br>
    </tt><tt><br>
    </tt><tt>    case LWS_CONNMODE_WS_SERVING:</tt><tt><br>
    </tt><tt>    case LWS_CONNMODE_WS_CLIENT:</tt><tt><br>
    </tt><tt><br>
    </tt><tt>        /* handle session socket closed */</tt><tt><br>
    </tt><tt><br>
    </tt><tt>        if ((!(pollfd->revents & POLLIN)) &&</tt><tt><br>
    </tt><tt>                (pollfd->revents & (POLLERR |
      POLLHUP))) {</tt><tt><br>
    </tt><tt><br>
    </tt><tt>            lwsl_debug("Session Socket %p (fd=%d) dead\n",</tt><tt><br>
    </tt><tt>                (void *)wsi, pollfd->fd);</tt><tt><br>
    </tt><tt><br>
    </tt><tt>            goto close_and_handled;</tt><tt><br>
    </tt><tt>        }</tt><br>
    <br>
    Regards<br>
    Graham<br>
    p.s. I think libwebsockets is an excellent library for lightweight
    websockets support especially for embedded systems.<br>
    <br>
    <div class="moz-signature">-- <br>
      <!-- Begin Peavey Digital Research e-mail signature - last modified 04/10/2012 by Stephen Joy -->
      <table cellpadding="0" cellspacing="0" width="90%">
        <tbody>
          <tr>
            <td
style="font-size:12.0pt;font-weight:bold;font-family:Arial,sans-serif;color:black">Graham
              Newton</td>
          </tr>
          <tr>
            <td
style="font-size:10.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">Senior
              Software Engineer</td>
          </tr>
          <tr>
            <td>
              <hr color="#0000A0"></td>
          </tr>
          <tr>
            <td
style="font-size:10.0pt;font-weight:bold;font-family:Arial,sans-serif;color:black">Peavey
              Digital Research</td>
          </tr>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">A
              Division of Peavey Electronics Corporation</td>
          </tr>
        </tbody>
      </table>
      <br>
      <table cellpadding="0" cellspacing="0">
        <tbody>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"
              width="50">Phone</td>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">+44
              1865 734397</td>
          </tr>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">Direct</td>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">+44
              1865 734397</td>
          </tr>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">Email</td>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><a class="moz-txt-link-abbreviated" href="mailto:gnewton@peavey-eu.com">gnewton@peavey-eu.com</a></td>
          </tr>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black">Web</td>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><a
                href="http://www.peaveycommercialaudio.com">www.peaveycommercialaudio.com</a>
              -
              <a href="http://mm.peavey.com">mm.peavey.com</a> -
              <a href="http://www.crestaudio.com">www.crestaudio.com</a>
              -
              <a href="http://aa.peavey.com">aa.peavey.com</a> -
              <a href="http://www.peaveyoxford.com">www.peaveyoxford.com</a>
            </td>
          </tr>
        </tbody>
      </table>
      <br>
      <table cellpadding="0" cellspacing="0">
        <tbody>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
                COMMERCIAL AUDIO</b> - Great Folds Road, Corby,
              Northamptonshire, NN18 9ET UK</td>
          </tr>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
                DIGITAL RESEARCH</b> - 6 Elm Place, Eynsham, Oxfordshire
              OX29 4BD UK</td>
          </tr>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
                ITALIA</b> - Via P.La Torre 21, Zona Ind.le Cerretano,
              60022 Castelfidardo An, Italy</td>
          </tr>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
                CHINA</b> - 1F Taiping Yaoye, 3 Gongye Wu Lu, Shekou,
              Shenzhen China 518067</td>
          </tr>
          <tr>
            <td
style="font-size:8.0pt;font-weight:normal;font-family:Arial,sans-serif;color:black"><b>PEAVEY
                ELECTRONICS CORPORATION</b> - 5022 Hartley Peavey Drive,
              Meridian, MS 39305 USA</td>
          </tr>
        </tbody>
      </table>
      <br>
      <table cellpadding="0" cellspacing="0">
        <tbody>
          <tr>
            <td
style="font-size:7.0pt;font-weight:normal;font-family:Arial,sans-serif;color:#929292">Peavey
              Electronics Limited is a registered company in England
              & Wales, Company Registration No.: 01249126
              <br>
              Registered office: GREAT FOLDS ROAD OAKLEY HAY CORBY
              NORTHAMPTONSHIRE. NN18 9ET</td>
          </tr>
        </tbody>
      </table>
      <!-- End Peavey Digital Research e-mail signature -->
    </div>
  </body>
</html>