clean more whitespace
authorAndy Green <andy.green@linaro.org>
Sat, 5 Dec 2015 13:51:47 +0000 (21:51 +0800)
committerAndy Green <andy.green@linaro.org>
Sat, 5 Dec 2015 13:52:41 +0000 (21:52 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/server.c
lib/service.c

index f9a8459..5d998e1 100644 (file)
@@ -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;
 }
 
index d39e8bc..dd161a4 100644 (file)
@@ -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: