unionize mutually exclusive wsi members
authorAndy Green <andy.green@linaro.org>
Mon, 21 Jan 2013 03:04:23 +0000 (11:04 +0800)
committerAndy Green <andy.green@linaro.org>
Mon, 21 Jan 2013 03:06:34 +0000 (11:06 +0800)
commit623a98dab00445ccbdf1887a2d56e4cf79033bf6
tree98227b24f68b505a6451cae1688ea3ba80f94270
parent80f168b4ee0f143949026d6a40448afa76064875
unionize mutually exclusive wsi members

Large chunks of struct libwebsocket members actually have a mutually
exclusive lifecycle, eg, once the http headers are finished they sit
there unused until the instance is destroyed.

This makes a big improvement in memory efficiency by making four
categories of member: always needed, needed for header processing,
needed for http processing, and needed for ws processing.  The last
three are mutually exclusive and bound into a union inside the wsi.

Care needs taking now at "union transitions", although we zeroed down
the struct at init, the other union siblings have been writing the
same memory by the time later member siblings start to use it.  So
it must be cleared down appropriately when we cross from one
mutually-exclusive use to another.

Signed-off-by: Andy Green <andy.green@linaro.org>
lib/client-handshake.c
lib/client-parser.c
lib/client.c
lib/extension-deflate-frame.c
lib/handshake.c
lib/libwebsockets.c
lib/output.c
lib/parsers.c
lib/private-libwebsockets.h
lib/server-handshake.c
lib/server.c