diff options
author | Andy Green <andy@warmcat.com> | 2016-04-06 09:39:48 +0800 |
---|---|---|
committer | Andy Green <andy@warmcat.com> | 2016-04-07 18:56:40 +0800 |
commit | 101bd4272a251e095cf681401f6a1fb79cf724a9 (patch) | |
tree | 041e0533aecc38a81b8af9c089ce07564f0657b3 | |
parent | 9ec343d795fedba3bc2459184a1e9b2cf2846a44 (diff) | |
download | libwebsockets-101bd4272a251e095cf681401f6a1fb79cf724a9.tar.gz libwebsockets-101bd4272a251e095cf681401f6a1fb79cf724a9.tar.bz2 libwebsockets-101bd4272a251e095cf681401f6a1fb79cf724a9.zip |
lws_service_adjust_timeout optimize
Make it exit quicker if something is pending
Signed-off-by: Andy Green <andy@warmcat.com>
-rw-r--r-- | lib/service.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/service.c b/lib/service.c index 64a07590..c0820c69 100644 --- a/lib/service.c +++ b/lib/service.c @@ -369,13 +369,13 @@ lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi) /* 1) if we know we are draining rx ext, do not wait in poll */ if (pt->rx_draining_ext_list) - timeout_ms = 0; + return 0; #ifdef LWS_OPENSSL_SUPPORT /* 2) if we know we have non-network pending data, do not wait in poll */ if (lws_ssl_anybody_has_buffered_read_tsi(context, tsi)) { - timeout_ms = 0; - lwsl_err("ssl buffered read\n"); + lwsl_info("ssl buffered read\n"); + return 0; } #endif @@ -384,8 +384,7 @@ lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi) if (pt->ah_pool[n].rxpos != pt->ah_pool[n].rxlen) { /* any ah with pending rx must be attached to someone */ assert(pt->ah_pool[n].wsi); - timeout_ms = 0; - break; + return 0; } return timeout_ms; |