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:
/* 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;
* 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);
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;
}
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");
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: