lws_bind_protocol
authorAndy Green <andy@warmcat.com>
Sat, 18 Jun 2016 01:00:04 +0000 (09:00 +0800)
committerAndy Green <andy@warmcat.com>
Sat, 18 Jun 2016 01:36:27 +0000 (09:36 +0800)
commit7f92ee802c4ffd3802a5180469082d27f49fb462
tree7219888f215c5bb5b63010664d59858c83bdb044
parent7a2fc442b61cb08a4ffbcdee0912fd56941e7d46
lws_bind_protocol

When using http/1.1+ keepalive and mounts, the relationship between
a connection and a protocol becomes dynamic.  The same connection might
visit different bits of the url space served by different mounts using
different protocols.

This patch ensures protocols can cleanly manage their per-connection
allocations by using the following callbacks when the protocol changes

 LWS_CALLBACK_HTTP_BIND_PROTOCOL
 LWS_CALLBACK_HTTP_DROP_PROTOCOL

For example if the pss wants to malloc stuff at runtime, it should do it
in LWS_CALLBACK_HTTP_BIND_PROTOCOL or later, and clean it up in
...DROP_PROTOCOL.

Signed-off-by: Andy Green <andy@warmcat.com>
lib/libwebsockets.h
lib/private-libwebsockets.h
lib/server.c
test-server/test-server-http.c