From 864d9026a8771e824d46d04b3f0680ae29f24325 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 30 Jan 2011 11:43:51 +0000 Subject: [PATCH] add-user-allocation-for-client-connects.patch Signed-off-by: Andy Green --- lib/client-handshake.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/client-handshake.c b/lib/client-handshake.c index e5d53510..e2d21439 100644 --- a/lib/client-handshake.c +++ b/lib/client-handshake.c @@ -507,6 +507,19 @@ check_accept: strcpy(p, magic_websocket_04_masking_guid); SHA1((unsigned char *)buf, strlen(buf), wsi->masking_key_04); + /* allocate the per-connection user memory (if any) */ + + if (wsi->protocol->per_session_data_size) { + wsi->user_space = malloc( + wsi->protocol->per_session_data_size); + if (wsi->user_space == NULL) { + fprintf(stderr, "Out of memory for " + "conn user space\n"); + goto bail2; + } + } else + wsi->user_space = NULL; + /* okay he is good to go */ this->fds[this->fds_count].fd = wsi->sock;