Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1713479133, "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":"009ffe829cdea8add0b9ef5ece734f55", "commit": {"type":"commit", "time": 1524048453, "time_ofs": 480, "oid_tree": { "oid": "f48cdb4c948ebaea8226c7cda3a5471e55c4a119", "alias": []}, "oid":{ "oid": "00b1d2289f180d0352c74d9fb2775ebdfb0e9568", "alias": []}, "msg": "tcp keepalive: user TCP_USER_TIMEOUT on linux if extant", "sig_commit": { "git_time": { "time": 1524048453, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1524048453, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "tcp keepalive: user TCP_USER_TIMEOUT on linux if extant\n\nhttps://github.com/warmcat/libwebsockets/issues/1223\n" , "diff": "diff --git a/CMakeLists.txt b/CMakeLists.txt\nindex c62d7f9..9fd040a 100644\n--- a/CMakeLists.txt\n+++ b/CMakeLists.txt\n@@ -1199,6 +1199,12 @@ else()\n CHECK_FUNCTION_EXISTS(TLS_client_method LWS_HAVE_TLS_CLIENT_METHOD)\n CHECK_FUNCTION_EXISTS(TLSv1_2_client_method LWS_HAVE_TLSV1_2_CLIENT_METHOD)\n endif()\n+\n+# tcp keepalive needs this on linux to work practically... but it only exists\n+# after kernel 2.6.37\n+\n+CHECK_C_SOURCE_COMPILES(\u0022#include \u003clinux/tcp.h\u003e\u005cnint main(void) { return TCP_USER_TIMEOUT; }\u005cn\u0022 LWS_HAVE_TCP_USER_TIMEOUT)\n+\n set(CMAKE_REQUIRED_LIBRARIES ${temp})\n # Generate the lws_config.h that includes all the public compilation settings.\n configure_file(\ndiff --git a/cmake/lws_config_private.h.in b/cmake/lws_config_private.h.in\nindex 8ad39a2..752aae6 100644\n--- a/cmake/lws_config_private.h.in\n+++ b/cmake/lws_config_private.h.in\n@@ -87,6 +87,8 @@\n /* Define to 1 if you have the \u003cunistd.h\u003e header file. */\n #cmakedefine LWS_HAVE_UNISTD_H\n \n+#cmakedefine LWS_HAVE_TCP_USER_TIMEOUT\n+\n /* Define to 1 if you have the `vfork' function. */\n #cmakedefine LWS_HAVE_VFORK\n \ndiff --git a/lib/plat/lws-plat-unix.c b/lib/plat/lws-plat-unix.c\nindex a51e67b..8476ec6 100644\n--- a/lib/plat/lws-plat-unix.c\n+++ b/lib/plat/lws-plat-unix.c\n@@ -262,6 +262,14 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)\n \t\t */\n #else\n \t\t/* set the keepalive conditions we want on it too */\n+\n+#if defined(LWS_HAVE_TCP_USER_TIMEOUT)\n+\t\toptval \u003d 1000 * (vhost-\u003eka_time +\n+\t\t\t\t (vhost-\u003eka_interval * vhost-\u003eka_probes));\n+\t\tif (setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT,\n+\t\t\t (const void *)\u0026optval, optlen) \u003c 0)\n+\t\t\treturn 1;\n+#endif\n \t\toptval \u003d vhost-\u003eka_time;\n \t\tif (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE,\n \t\t\t (const void *)\u0026optval, optlen) \u003c 0)\n","s":{"c":1713479133,"u": 4659}} ],"g": 5627,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}