From f7e2a85e11d4efe6f64337c628a143df5822bc8b Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 16 Oct 2015 10:54:04 +0800 Subject: [PATCH] complain if zero ka_interval used with positive ka_time https://github.com/warmcat/libwebsockets/issues/308 Signed-off-by: Andy Green --- lib/context.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/context.c b/lib/context.c index fbf5b2f..6ac2440 100644 --- a/lib/context.c +++ b/lib/context.c @@ -126,6 +126,11 @@ libwebsocket_create_context(struct lws_context_creation_info *info) context->ka_interval = info->ka_interval; context->ka_probes = info->ka_probes; + if (!info->ka_interval && info->ka_time > 0) { + lwsl_err("info->ka_interval can't be 0 if ka_time used\n"); + return NULL; + } + #ifdef LWS_USE_LIBEV /* (Issue #264) In order to *avoid breaking backwards compatibility*, we * enable libev mediated SIGINT handling with a default handler of -- 2.7.4