Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1752734516, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"7db66b9b838b483469fa3159da1681e4", "commit": {"type":"commit", "time": 1289562459, "time_ofs": 0, "oid_tree": { "oid": "a2f62a94481282b0cc3277bc8ba982fcf2b0887b", "alias": []}, "oid":{ "oid": "85ba32fcbf6ae9773c31c88cba898ef41139b074", "alias": []}, "msg": "fix-revents-inherited-from-old-socket-bug.patch", "sig_commit": { "git_time": { "time": 1289562459, "offset": 0 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1289562459, "offset": 0 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "fix-revents-inherited-from-old-socket-bug.patch\n\nSigned-off-by: Andy Green \u003candy@warmcat.com\u003e\n" , "diff": "diff --git a/lib/handshake.c b/lib/handshake.c\nindex 95297a0..60f3fda 100644\n--- a/lib/handshake.c\n+++ b/lib/handshake.c\n@@ -169,7 +169,6 @@ libwebsocket_read(struct libwebsocket *wsi, unsigned char * buf, size_t len)\n \t\t\t\t\t\t\t \u0022conn user space\u005cn\u0022);\n \t\t\t\tgoto bail;\n \t\t\t}\n-\t\t\tfprintf(stderr, \u0022user allocated %d at %p for wsi %p\u005cn\u0022, wsi-\u003eprotocol-\u003eper_session_data_size, wsi-\u003euser_space, wsi);\n \t\t} else\n \t\t\twsi-\u003euser_space \u003d NULL;\n \t\t\ndiff --git a/lib/libwebsockets.c b/lib/libwebsockets.c\nindex c680e52..f4d8c71 100644\n--- a/lib/libwebsockets.c\n+++ b/lib/libwebsockets.c\n@@ -280,7 +280,7 @@ int libwebsocket_create_server(int port,\n \n \t\tn \u003d poll(fds, fds_count, 50);\n \t\tif (n \u003c 0 || fds[0].revents \u0026 (POLLERR | POLLHUP)) {\n-//\t\t\tfprintf(stderr, \u0022Listen Socket dead\u005cn\u0022);\n+\t\t\tfprintf(stderr, \u0022Listen Socket dead\u005cn\u0022);\n \t\t\tgoto fatal;\n \t\t}\n \t\tif (n \u003d\u003d 0) /* poll timeout */\n@@ -379,6 +379,13 @@ int libwebsocket_create_server(int port,\n \n \t\t\tfds[fds_count].events \u003d POLLIN;\n \t\t\tfds[fds_count++].fd \u003d fd;\n+\n+\t\t\t/*\n+\t\t\t * make sure NO events are seen yet on this new socket\n+\t\t\t * (otherwise we inherit old fds[client].revents from\n+\t\t\t * previous socket there and die mysteriously! )\n+\t\t\t */\n+\t\t\tfds[client].revents \u003d 0;\n \t\t}\n \t\t\n \t\t/* check for activity on client sockets */\n@@ -389,7 +396,8 @@ int libwebsocket_create_server(int port,\n \t\t\t\n \t\t\tif (fds[client].revents \u0026 (POLLERR | POLLHUP)) {\n \t\t\t\t\n-\t\t\t\tfprintf(stderr, \u0022Session Socket dead\u005cn\u0022);\n+\t\t\t\tdebug(\u0022Session Socket %d %p (fd\u003d%d) dead\u005cn\u0022,\n+\t\t\t\t\t client, wsi[client], fds[client]);\n \n \t\t\t\tlibwebsocket_close_and_free_session(\n \t\t\t\t\t\t\t\t wsi[client]);\n@@ -429,12 +437,16 @@ int libwebsocket_create_server(int port,\n \t\t\t * socket handle and wsi from our service list\n \t\t\t */\n nuke_this:\n-\t\t\tfor (n \u003d client; n \u003c fds_count - 1; n++) {\n+\n+\t\t\tdebug(\u0022nuking wsi %p, fsd_count \u003d %d\u005cn\u0022,\n+\t\t\t\t\t\t wsi[client], fds_count - 1);\n+\n+\t\t\tfds_count--;\n+\t\t\tfor (n \u003d client; n \u003c fds_count; n++) {\n \t\t\t\tfds[n] \u003d fds[n + 1];\n \t\t\t\twsi[n] \u003d wsi[n + 1];\n \t\t\t}\n-\t\t\tfds_count--;\n-\t\t\tclient--;\n+\t\t\tbreak;\n \t\t}\n \n poll_out:\t\t\n","s":{"c":1752734516,"u": 1251}} ],"g": 1816,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}