[Libwebsockets] [libwebsockets] #60: Crash on Windows because of getdtablesize()

Trac trac at libwebsockets.org
Tue Jan 27 12:35:25 CET 2015


#60: Crash on Windows because of getdtablesize()
------------------------------------+-----------------
  Reporter:  JonMerel               |      Owner:
      Type:  defect                 |     Status:  new
  Priority:  blocker                |  Milestone:
 Component:  libwebsockets library  |    Version:
Resolution:                         |   Keywords:
------------------------------------+-----------------

Comment (by bdavis9659@…):

 I have been having the same problem with windows, This evening I coded up
 real quick a lookup table where I replaced every access into lws_lookup
 with a function call.

  context->lws_lookup[wsi->sock] = wsi;

 turns into

   contxt->lws_lookup[lws_lookup_idx ( contxt->lut, contxt->max_fds,
 wsi->sock)] = wsi;

 Just a quick hack so other work can continue.  Will try to come up with a
 better solution in the next couple of days.

 While looking into this, I am amazed at this line of code:

  context->max_fds = getdtablesize();

 In windows it is set by a macro defined to be 30000.  In linux,
 "something" sets it to 1024.  What am I missing ?  How does this work ?

 Andy, excellent implementation.  I was able to 'butcher' up the test-
 server to implement my sub-protocol with little trouble.  Or knowledge;
 just cut and paste one of the existing protocols and edit it to what I
 needed.  Nice work.


 regards,
 Bud Davis

--
Ticket URL: <http://libwebsockets.org/trac/libwebsockets/ticket/60#comment:4>
libwebsockets <http://libwebsockets.org>
libwebsockets C library



More information about the Libwebsockets mailing list