1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/lib/core
Andy Green 5c0b0450f2 client: bind and drop protocol like server
HTTP server protocols have had for a while LWS_CALLBACK_HTTP_DROP/BIND_PROTOCOL
callbacks that mark when a wsi is attched to a protocol and detached.

It turns out this is generally useful for everything to know when a wsi is
joining a protocol and definitively completely finished with a protocol.

Particularly with client wsi where you provided the userdata externally, this
makes a clear point to free() it on the protocol binding being dropped.

This patch adds protocol bind / unbind callbacks to the role definition and
lets them operate on all roles.  For the various roles

HTTP server: LWS_CALLBACK_HTTP_BIND/DROP_PROTOCOL as before
HTTP client: LWS_CALLBACK_CLIENT_HTTP_BIND/DROP_PROTOCOL
ws server:   LWS_CALLBACK_WS_SERVER_BIND/DROP_PROTOCOL
ws client:   LWS_CALLBACK_WS_CLIENT_BIND/DROP_PROTOCOL
raw file:    LWS_CALLBACK_RAW_FILE_BIND/DROP_PROTOCOL
raw skt:     LWS_CALLBACK_RAW_SKT_BIND/DROP_PROTOCOL
2018-08-18 14:11:29 +08:00
..
adopt.c vhost_destroy: use vhost wsi reference counting to trigger destroy 2018-06-18 09:11:46 +08:00
alloc.c refactor: core code in lib/core and private-libwebsockets.h to core/private.h 2018-05-03 10:49:36 +08:00
connect.c client: bind and drop protocol like server 2018-08-18 14:11:29 +08:00
context.c unix socket: fixes and improvements 2018-08-14 08:00:30 +08:00
libwebsockets.c client: bind and drop protocol like server 2018-08-18 14:11:29 +08:00
output.c http: defer transaction completed if partial pending 2018-06-20 16:41:27 +08:00
pollfd.c client: SMP: associate client with tsi of thread creating client connection 2018-08-14 08:00:30 +08:00
private.h libwebsockets.h: clean out some boilerplate better put in core/private.h 2018-08-16 19:10:32 +08:00
service.c vhost protocol timers: SMP threadsafety 2018-08-14 08:00:30 +08:00