fix spinning on NULL protocol name
authorAndy Green <andy.green@linaro.org>
Mon, 11 Aug 2014 01:11:57 +0000 (09:11 +0800)
committerAndy Green <andy.green@linaro.org>
Mon, 11 Aug 2014 01:11:57 +0000 (09:11 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/server.c

index aad5286..21ccd16 100644 (file)
@@ -389,8 +389,10 @@ int lws_handshake_server(struct libwebsocket_context *context,
 
                        n = 0;
                        while (context->protocols[n].callback) {
-                               if (!wsi->protocol->name)
+                               if (!wsi->protocol->name) {
+                                       n++;
                                        continue;
+                               }
                                if (!strcmp(context->protocols[n].name,
                                            protocol_name)) {
                                        lwsl_info("prot match %d\n", n);