canonical libwebsockets.org websocket library
![]() This big patch replaces the malloc / realloc per header approach used until now with a single three-level struct that gets malloc'd during the header union phase and freed in one go when we transition to a different union phase. It's more expensive in that we malloc a bit more than 4Kbytes, but it's a lot cheaper in terms of malloc, frees, heap fragmentation, no reallocs, nothing to configure. It also moves from arrays of pointers (8 bytes on x86_64) to unsigned short offsets into the data array, (2 bytes on all platforms). The 3-level thing is all in one struct - array indexed by the header enum, pointing to first "fragment" index (ie, header type to fragment lookup, or 0 for none) - array of fragments indexes, enough for 2 x the number of known headers (fragment array... note that fragments can point to a "next" fragment if the same header is spread across multiple entries) - linear char array where the known header payload gets written (fragments point into null-terminated strings stored in here, only the known header content is stored) http headers can legally be split over multiple headers of the same name which should be concatenated. This scheme does not linearly conatenate them but uses a linked list in the fragment structs to link them. There are apis to get the total length and copy out a linear, concatenated version to a buffer. Signed-off-by: Andy Green <andy.green@linaro.org> |
||
---|---|---|
cmake | ||
lib | ||
m4 | ||
scripts | ||
test-server | ||
win32port | ||
.gitignore | ||
autogen.sh | ||
changelog | ||
CMakeLists.txt | ||
config.h.cmake | ||
configure.ac | ||
COPYING | ||
INSTALL | ||
libwebsockets-api-doc.html | ||
libwebsockets.pc.in | ||
libwebsockets.spec | ||
LICENSE | ||
Makefile.am | ||
README | ||
README.build | ||
README.coding | ||
README.test-apps |
This is the libwebsockets C library for lightweight websocket clients and servers. For support, visit http://libwebsockets.org and consider joining the project mailing list at http://ml.libwebsockets.org/mailman/listinfo/libwebsockets You can get the latest version of the library from git http://git.libwebsockets.org https://github.com/warmcat/libwebsockets for more information: README.build - information on building the library README.coding - information for writing code using the library README.test-apps - information about the test apps built with the library