complain if zero ka_interval used with positive ka_time
authorAndy Green <andy.green@linaro.org>
Fri, 16 Oct 2015 02:54:04 +0000 (10:54 +0800)
committerAndy Green <andy.green@linaro.org>
Fri, 16 Oct 2015 02:54:04 +0000 (10:54 +0800)
https://github.com/warmcat/libwebsockets/issues/308

Signed-off-by: Andy Green <andy.green@linaro.org>
lib/context.c

index fbf5b2f..6ac2440 100644 (file)
@@ -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