[Libwebsockets] [libwebsockets] #15: Removal of public close...

Trac trac at libwebsockets.org
Thu Feb 14 14:19:24 CET 2013


#15: Removal of public close...
------------------------------------+--------------------
  Reporter:  Joakim                 |      Owner:  agreen
      Type:  defect                 |     Status:  new
  Priority:  major                  |  Milestone:
 Component:  libwebsockets library  |    Version:
Resolution:                         |   Keywords:
------------------------------------+--------------------

Comment (by agreen):

 You can ask for a callback when writeable and seeing the state is that you
 want to close, return asking to close from the writeable callback.  If the
 socket is in error state itself, it'll get closed by the library.

 The problem is not only that the close function may (or may not) free the
 wsi, but it's able to do it during any user callback, invalidating the wsi
 that the code calling the callback holds, or even asynchronously.

 By making the user code ask the callback caller code to close, the code
 calling the callback can synchronize the actual close and freeing of the
 wsi.

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



More information about the Libwebsockets mailing list