From e53f2ed5e6644a1e3db910bce88d125fd042d3f8 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 5 Dec 2015 21:51:47 +0800 Subject: [PATCH] clean more whitespace Signed-off-by: Andy Green --- lib/server.c | 18 +++++++++--------- lib/service.c | 14 +++++++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/server.c b/lib/server.c index f9a8459b..5d998e1f 100644 --- a/lib/server.c +++ b/lib/server.c @@ -726,8 +726,8 @@ int lws_server_socket_service(struct lws_context *context, if (pollfd->revents & LWS_POLLIN) { len = lws_ssl_capable_read(context, wsi, - context->service_buffer, - sizeof(context->service_buffer)); + context->service_buffer, + sizeof(context->service_buffer)); lwsl_debug("%s: read %d\r\n", __func__, len); switch (len) { case 0: @@ -750,7 +750,7 @@ int lws_server_socket_service(struct lws_context *context, /* hm this may want to send (via HTTP callback for example) */ n = lws_read(context, wsi, - context->service_buffer, len); + context->service_buffer, len); if (n < 0) /* we closed wsi */ return 0; @@ -858,9 +858,9 @@ try_pollout: * set properties of the newly created wsi. There's no protocol * selected yet so we issue this to protocols[0] */ - (context->protocols[0].callback)(context, new_wsi, - LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED, NULL, NULL, 0); + LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED, + NULL, NULL, 0); lws_libev_accept(context, new_wsi, accept_fd); @@ -878,15 +878,15 @@ try_pollout: break; } - if (lws_server_socket_service_ssl(context, &wsi, new_wsi, - accept_fd, pollfd)) + if (lws_server_socket_service_ssl(context, &wsi, new_wsi, accept_fd, + pollfd)) goto fail; return 0; fail: - lws_close_and_free_session(context, wsi, - LWS_CLOSE_STATUS_NOSTATUS); + lws_close_and_free_session(context, wsi, LWS_CLOSE_STATUS_NOSTATUS); + return 1; } diff --git a/lib/service.c b/lib/service.c index d39e8bca..dd161a4c 100644 --- a/lib/service.c +++ b/lib/service.c @@ -540,8 +540,9 @@ lws_service_fd(struct lws_context *context, struct lws_pollfd *pollfd) read: eff_buf.token_len = lws_ssl_capable_read(context, wsi, - context->service_buffer, - pending?pending:sizeof(context->service_buffer)); + context->service_buffer, + pending ? pending : + sizeof(context->service_buffer)); switch (eff_buf.token_len) { case 0: lwsl_info("service_fd: closing due to 0 length read\n"); @@ -633,9 +634,12 @@ handle_pending: close_and_handled: lwsl_debug("Close and handled\n"); - lws_close_and_free_session(context, wsi, - LWS_CLOSE_STATUS_NOSTATUS); - // pollfd points to something else after the close + lws_close_and_free_session(context, wsi, LWS_CLOSE_STATUS_NOSTATUS); + /* + * pollfd may point to something else after the close + * due to pollfd swapping scheme on delete on some platforms + * we can't clear revents now because it'd be the wrong guy's revents + */ return 1; handled: