force service properly when unconsumed rxbuf in ah
authorAndy Green <andy.green@linaro.org>
Fri, 26 Feb 2016 02:48:51 +0000 (10:48 +0800)
committerAndy Green <andy.green@linaro.org>
Fri, 26 Feb 2016 02:48:51 +0000 (10:48 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/lws-plat-unix.c

index 354e9c6..48a8970 100644 (file)
@@ -158,15 +158,16 @@ lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
                return 0;
        }
 
-       if (n < 0) {
-               if (LWS_ERRNO != LWS_EINTR)
-                       return -1;
-               return 0;
-       }
-
-       c = n;
-
-       lws_service_flag_pending(context, tsi);
+       m = lws_service_flag_pending(context, tsi);
+       if (m)
+               c = -1; /* unknown limit */
+       else
+               if (n < 0) {
+                       if (LWS_ERRNO != LWS_EINTR)
+                               return -1;
+                       return 0;
+               } else
+                       c = n;
 
        /* any socket with events to service? */
        for (n = 0; n < pt->fds_count && c; n++) {