diff --git a/lib/alloc.c b/lib/alloc.c
index 898db12464aa538e0e45da96c6e7667530138d36..2060aac2d84556b0f183065fe17cd35f5b912d3c 100644
--- a/lib/alloc.c
+++ b/lib/alloc.c
@@ -52,9 +52,11 @@ static void *_realloc(void *ptr, size_t size, const char *reason)
{
if (size) {
#if defined(LWS_PLAT_ESP32)
- lwsl_notice("%s: size %lu: %s\n", __func__, (unsigned long)size, reason);
+ lwsl_notice("%s: size %lu: %s\n", __func__,
+ (unsigned long)size, reason);
#else
- lwsl_debug("%s: size %lu: %s\n", __func__, (unsigned long)size, reason);
+ lwsl_debug("%s: size %lu: %s\n", __func__,
+ (unsigned long)size, reason);
#endif
#if defined(LWS_PLAT_OPTEE)
return (void *)TEE_Realloc(ptr, size);
diff --git a/lib/context.c b/lib/context.c
index e548601a144943892fd10e9956fe12ba86aeb4a8..23b64ab00cb58f1a32281c83b8af7c550f14ff57 100644
--- a/lib/context.c
+++ b/lib/context.c
@@ -119,7 +119,8 @@ lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost,
/* allocate the vh priv array only on demand */
if (!vhost->protocol_vh_privs) {
vhost->protocol_vh_privs = (void **)lws_zalloc(
- vhost->count_protocols * sizeof(void *), "protocol_vh_privs");
+ vhost->count_protocols * sizeof(void *),
+ "protocol_vh_privs");
if (!vhost->protocol_vh_privs)
return NULL;
}
@@ -232,7 +233,9 @@ lws_protocol_init(struct lws_context *context)
while (pvo) {
lwsl_notice(
- " vhost \"%s\", protocol \"%s\", option \"%s\"\n",
+ " vhost \"%s\", "
+ "protocol \"%s\", "
+ "option \"%s\"\n",
vh->name,
vh->protocols[n].name,
pvo->name);
@@ -325,14 +328,16 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
LWS_CB_REASON_AUX_BF__CGI)) {
n = lws_cgi_write_split_stdout_headers(wsi);
if (n < 0) {
- lwsl_debug("LWS_CB_REASON_AUX_BF__CGI forcing close\n");
+ lwsl_debug("AUX_BF__CGI forcing close\n");
return -1;
}
if (!n)
- lws_rx_flow_control(wsi->cgi->stdwsi[LWS_STDOUT], 1);
+ lws_rx_flow_control(
+ wsi->cgi->stdwsi[LWS_STDOUT], 1);
if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_HEADERS)
- wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__CGI_HEADERS;
+ wsi->reason_bf &=
+ ~LWS_CB_REASON_AUX_BF__CGI_HEADERS;
else
wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__CGI;
break;
@@ -341,12 +346,13 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_CHUNK_END) {
if (!wsi->http2_substream) {
memcpy(buf + LWS_PRE, "0\x0d\x0a\x0d\x0a", 5);
- lwsl_debug("writing chunk terminator and exiting\n");
- n = lws_write(wsi, (unsigned char *)buf + LWS_PRE,
- 5, LWS_WRITE_HTTP);
+ lwsl_debug("writing chunk term and exiting\n");
+ n = lws_write(wsi, (unsigned char *)buf +
+ LWS_PRE, 5, LWS_WRITE_HTTP);
} else
- n = lws_write(wsi, (unsigned char *)buf + LWS_PRE,
- 0, LWS_WRITE_HTTP_FINAL);
+ n = lws_write(wsi, (unsigned char *)buf +
+ LWS_PRE, 0,
+ LWS_WRITE_HTTP_FINAL);
/* always close after sending it */
return -1;
@@ -366,7 +372,8 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
wsi->reason_bf &= ~LWS_CB_REASON_AUX_BF__PROXY;
if (!lws_get_child(wsi))
break;
- if (lws_http_client_read(lws_get_child(wsi), &px, &lenx) < 0)
+ if (lws_http_client_read(lws_get_child(wsi), &px,
+ &lenx) < 0)
return -1;
break;
}
@@ -571,7 +578,8 @@ lws_create_vhost(struct lws_context *context,
#endif
vh->iface = info->iface;
-#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32) && !defined(OPTEE_TA) && !defined(WIN32)
+#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32) && \
+ !defined(OPTEE_TA) && !defined(WIN32)
vh->bind_iface = info->bind_iface;
#endif
@@ -599,9 +607,9 @@ lws_create_vhost(struct lws_context *context,
* give the vhost a unified list of protocols including the
* ones that came from plugins
*/
- lwsp = lws_zalloc(sizeof(struct lws_protocols) *
- (vh->count_protocols +
- context->plugin_protocol_count + 1), "vhost-specific plugin table");
+ lwsp = lws_zalloc(sizeof(struct lws_protocols) * (vh->count_protocols +
+ context->plugin_protocol_count + 1),
+ "vhost-specific plugin table");
if (!lwsp) {
lwsl_err("OOM\n");
return NULL;
@@ -653,7 +661,8 @@ lws_create_vhost(struct lws_context *context,
}
vh->same_vh_protocol_list = (struct lws **)
- lws_zalloc(sizeof(struct lws *) * vh->count_protocols, "same vh list");
+ lws_zalloc(sizeof(struct lws *) * vh->count_protocols,
+ "same vh list");
vh->mount_list = info->mounts;
@@ -677,14 +686,15 @@ lws_create_vhost(struct lws_context *context,
/* convert interpreter protocol names to pointers */
pvo = mounts->interpret;
while (pvo) {
- for (n = 0; n < vh->count_protocols; n++)
- if (!strcmp(pvo->value, vh->protocols[n].name)) {
- ((struct lws_protocol_vhost_options *)pvo)->value =
- (const char *)(lws_intptr_t)n;
- break;
- }
+ for (n = 0; n < vh->count_protocols; n++) {
+ if (strcmp(pvo->value, vh->protocols[n].name))
+ continue;
+ ((struct lws_protocol_vhost_options *)pvo)->
+ value = (const char *)(lws_intptr_t)n;
+ break;
+ }
if (n == vh->count_protocols)
- lwsl_err("ignoring unknown interpret protocol %s\n",
+ lwsl_err("ignoring unknown interp pr %s\n",
pvo->value);
pvo = pvo->next;
}
@@ -705,8 +715,8 @@ lws_create_vhost(struct lws_context *context,
* ones that came from plugins
*/
vh->extensions = lws_zalloc(sizeof(struct lws_extension) *
- (m +
- context->plugin_extension_count + 1), "extensions");
+ (m + context->plugin_extension_count + 1),
+ "extensions");
if (!vh->extensions)
return NULL;
@@ -809,6 +819,7 @@ lws_create_vhost(struct lws_context *context,
}
vh1 = &(*vh1)->vhost_next;
};
+
/* for the case we are adding a vhost much later, after server init */
if (context->protocol_init_done)
@@ -1015,7 +1026,8 @@ lws_create_context(struct lws_context_creation_info *info)
context->time_up = time(NULL);
- context->simultaneous_ssl_restriction = info->simultaneous_ssl_restriction;
+ context->simultaneous_ssl_restriction =
+ info->simultaneous_ssl_restriction;
#ifndef LWS_NO_DAEMONIZE
if (pid_daemon) {
@@ -1148,14 +1160,14 @@ lws_create_context(struct lws_context_creation_info *info)
context->ip_limit_wsi = info->ip_limit_wsi;
#endif
- lwsl_info(" mem: context: %5lu bytes (%ld ctx + (%ld thr x %d))\n",
+ lwsl_info(" mem: context: %5lu B (%ld ctx + (%ld thr x %d))\n",
(long)sizeof(struct lws_context) +
(context->count_threads * context->pt_serv_buf_size),
(long)sizeof(struct lws_context),
(long)context->count_threads,
context->pt_serv_buf_size);
- lwsl_info(" mem: http hdr rsvd: %5lu bytes (%u thr x (%u + %lu) x %u))\n",
+ lwsl_info(" mem: http hdr rsvd: %5lu B (%u thr x (%u + %lu) x %u))\n",
(long)(context->max_http_header_data +
sizeof(struct allocated_headers)) *
context->max_http_header_pool * context->count_threads,
@@ -1344,7 +1356,8 @@ lws_vhost_destroy1(struct lws_vhost *vh)
*/
if (vh->lserv_wsi)
- lws_start_foreach_ll(struct lws_vhost *, v, context->vhost_list) {
+ lws_start_foreach_ll(struct lws_vhost *, v,
+ context->vhost_list) {
if (v != vh &&
!v->being_destroyed &&
v->listen_port == vh->listen_port &&
diff --git a/lib/handshake.c b/lib/handshake.c
index 94bd881f7d1ec11f1948bfc685040c2d404b6a6a..d9bbfd2e3f5da2867f6434b79c3e2b9cda17be8f 100644
--- a/lib/handshake.c
+++ b/lib/handshake.c
@@ -231,7 +231,7 @@ postbody_completion:
if (!wsi->cgi)
#endif
{
- lwsl_notice("LWS_CALLBACK_HTTP_BODY_COMPLETION\n");
+ lwsl_notice("HTTP_BODY_COMPLETION\n");
n = wsi->protocol->callback(wsi,
LWS_CALLBACK_HTTP_BODY_COMPLETION,
wsi->user_space, NULL, 0);
@@ -255,8 +255,9 @@ postbody_completion:
switch (wsi->mode) {
case LWSCM_WS_SERVING:
- if (lws_interpret_incoming_packet(wsi, &buf, (size_t)len) < 0) {
- lwsl_info("interpret_incoming_packet has bailed\n");
+ if (lws_interpret_incoming_packet(wsi, &buf,
+ (size_t)len) < 0) {
+ lwsl_info("interpret_incoming_packet bailed\n");
goto bail;
}
break;
diff --git a/lib/header.c b/lib/header.c
index 7930e76baf9515a920be6697b493fbf4fef7112a..1e6b2596d93ac3e61d7ee3f176e82110284811c9 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -349,7 +349,8 @@ lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
if (lws_finalize_http_header(wsi, p, end))
return -1;
- n = lws_write(wsi, start, *p - start, LWS_WRITE_HTTP_HEADERS | LWS_WRITE_H2_STREAM_END);
+ n = lws_write(wsi, start, *p - start, LWS_WRITE_HTTP_HEADERS |
+ LWS_WRITE_H2_STREAM_END);
return n;
}
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index eee82e84fd7750565a430ab41ea4bdbab7031e5a..7fb742d7c9957a53aba3961e4e6e273bd91ed661 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -291,7 +291,8 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
if (wsi->premature_rx)
lws_free(wsi->premature_rx);
- if (wsi->pending_send_completion && !wsi->close_is_pending_send_completion) {
+ if (wsi->pending_send_completion &&
+ !wsi->close_is_pending_send_completion) {
lwsl_notice("delaying close\n");
wsi->close_is_pending_send_completion = 1;
return;
@@ -322,8 +323,10 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
#if defined(LWS_WITH_HTTP2)
if (wsi->u.h2.parent_wsi) {
- lwsl_info(" wsi: %p, his parent %p: siblings:\n", wsi, wsi->u.h2.parent_wsi);
- lws_start_foreach_llp(struct lws **, w, wsi->u.h2.parent_wsi->u.h2.child_list) {
+ lwsl_info(" wsi: %p, his parent %p: siblings:\n", wsi,
+ wsi->u.h2.parent_wsi);
+ lws_start_foreach_llp(struct lws **, w,
+ wsi->u.h2.parent_wsi->u.h2.child_list) {
lwsl_info(" \\---- child %p\n", *w);
} lws_end_foreach_llp(w, u.h2.sibling_list);
}
@@ -333,11 +336,13 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
if (wsi->u.h2.child_list) {
lwsl_info(" parent %p: closing children: list:\n", wsi);
- lws_start_foreach_llp(struct lws **, w, wsi->u.h2.child_list) {
+ lws_start_foreach_llp(struct lws **, w,
+ wsi->u.h2.child_list) {
lwsl_info(" \\---- child %p\n", *w);
} lws_end_foreach_llp(w, u.h2.sibling_list);
/* trigger closing of all of our http2 children first */
- lws_start_foreach_llp(struct lws **, w, wsi->u.h2.child_list) {
+ lws_start_foreach_llp(struct lws **, w,
+ wsi->u.h2.child_list) {
lwsl_info(" closing child %p\n", *w);
/* disconnect from siblings */
wsi2 = (*w)->u.h2.sibling_list;
@@ -370,7 +375,8 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
wsi2 = (*w)->u.h2.sibling_list;
(*w)->u.h2.sibling_list = NULL;
*w = wsi2;
- lwsl_info(" %p disentangled from sibling %p\n", wsi, wsi2);
+ lwsl_info(" %p disentangled from sibling %p\n",
+ wsi, wsi2);
break;
}
} lws_end_foreach_llp(w, u.h2.sibling_list);
@@ -470,9 +476,10 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
goto just_kill_connection;
default:
if (wsi->trunc_len) {
- lwsl_info("%p: start FLUSHING_STORED_SEND_BEFORE_CLOSE\n", wsi);
+ lwsl_info("%p: FLUSHING_STORED_SEND_BEFORE_CLOSE\n", wsi);
wsi->state = LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE;
- lws_set_timeout(wsi, PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE, 5);
+ lws_set_timeout(wsi,
+ PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE, 5);
return;
}
break;
@@ -498,7 +505,8 @@ lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason)
* parent and just his ch1 aspect is closing?
*/
- if (lws_ext_cb_active(wsi, LWS_EXT_CB_CHECK_OK_TO_REALLY_CLOSE, NULL, 0) > 0) {
+ if (lws_ext_cb_active(wsi, LWS_EXT_CB_CHECK_OK_TO_REALLY_CLOSE,
+ NULL, 0) > 0) {
lwsl_ext("extension vetoed close\n");
return;
}
@@ -595,7 +603,7 @@ just_kill_connection:
wsi->mode == LWSCM_WSCL_WAITING_CONNECT) &&
!wsi->already_did_cce) {
wsi->vhost->protocols[0].callback(wsi,
- LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
+ LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
wsi->user_space, NULL, 0);
}
@@ -752,8 +760,10 @@ just_kill_connection:
wsi->state_pre_close == LWSS_AWAITING_CLOSE_ACK ||
wsi->state_pre_close == LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION ||
wsi->state_pre_close == LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE ||
- (wsi->mode == LWSCM_WS_CLIENT && wsi->state_pre_close == LWSS_HTTP) ||
- (wsi->mode == LWSCM_WS_SERVING && wsi->state_pre_close == LWSS_HTTP))) {
+ (wsi->mode == LWSCM_WS_CLIENT &&
+ wsi->state_pre_close == LWSS_HTTP) ||
+ (wsi->mode == LWSCM_WS_SERVING &&
+ wsi->state_pre_close == LWSS_HTTP))) {
lwsl_debug("calling back CLOSED %d %d\n", wsi->mode, wsi->state);
wsi->protocol->callback(wsi, LWS_CALLBACK_CLOSED,
wsi->user_space, NULL, 0);
@@ -903,8 +913,8 @@ lws_get_addresses(struct lws_vhost *vh, void *ads, char *name,
if (strncmp(rip, "::ffff:", 7) == 0)
memmove(rip, rip + 7, strlen(rip) - 6);
- getnameinfo((struct sockaddr *)ads,
- sizeof(struct sockaddr_in6), name, name_len, NULL, 0, 0);
+ getnameinfo((struct sockaddr *)ads, sizeof(struct sockaddr_in6),
+ name, name_len, NULL, 0, 0);
return 0;
} else
@@ -1621,7 +1631,8 @@ lws_ensure_user_space(struct lws *wsi)
/* allocate the per-connection user memory (if any) */
if (wsi->protocol->per_session_data_size && !wsi->user_space) {
- wsi->user_space = lws_zalloc(wsi->protocol->per_session_data_size, "user space");
+ wsi->user_space = lws_zalloc(
+ wsi->protocol->per_session_data_size, "user space");
if (wsi->user_space == NULL) {
lwsl_err("%s: OOM\n", __func__);
return 1;
@@ -2263,8 +2274,8 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port,
#endif
#if defined(LWS_WITH_IPV6)
port = (sin.ss_family == AF_INET6) ?
- ntohs(((struct sockaddr_in6 *) &sin)->sin6_port) :
- ntohs(((struct sockaddr_in *) &sin)->sin_port);
+ ntohs(((struct sockaddr_in6 *) &sin)->sin6_port) :
+ ntohs(((struct sockaddr_in *) &sin)->sin_port);
#else
{
struct sockaddr_in sain;
@@ -2350,7 +2361,8 @@ lws_get_addr_scope(const char *ipaddr)
while (adapter && !found) {
addr = adapter->FirstUnicastAddress;
while (addr && !found) {
- if (addr->Address.lpSockaddr->sa_family == AF_INET6) {
+ if (addr->Address.lpSockaddr->sa_family ==
+ AF_INET6) {
sockaddr = (struct sockaddr_in6 *)
(addr->Address.lpSockaddr);
@@ -2880,63 +2892,117 @@ lws_stats_log_dump(struct lws_context *context)
lwsl_notice("\n");
lwsl_notice("LWS internal statistics dump ----->\n");
- lwsl_notice("LWSSTATS_C_CONNECTIONS: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_CONNECTIONS));
- lwsl_notice("LWSSTATS_C_API_CLOSE: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_API_CLOSE));
- lwsl_notice("LWSSTATS_C_API_READ: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_API_READ));
- lwsl_notice("LWSSTATS_C_API_LWS_WRITE: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_API_LWS_WRITE));
- lwsl_notice("LWSSTATS_C_API_WRITE: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_API_WRITE));
- lwsl_notice("LWSSTATS_C_WRITE_PARTIALS: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_WRITE_PARTIALS));
- lwsl_notice("LWSSTATS_C_WRITEABLE_CB_REQ: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB_REQ));
- lwsl_notice("LWSSTATS_C_WRITEABLE_CB_EFF_REQ: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB_EFF_REQ));
- lwsl_notice("LWSSTATS_C_WRITEABLE_CB: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB));
- lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN));
- lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_FAILED: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_FAILED));
- lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED));
- lwsl_notice("LWSSTATS_C_SSL_CONNS_HAD_RX: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SSL_CONNS_HAD_RX));
- lwsl_notice("LWSSTATS_C_PEER_LIMIT_AH_DENIED: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_PEER_LIMIT_AH_DENIED));
- lwsl_notice("LWSSTATS_C_PEER_LIMIT_WSI_DENIED: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_PEER_LIMIT_WSI_DENIED));
-
- lwsl_notice("LWSSTATS_C_TIMEOUTS: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_TIMEOUTS));
- lwsl_notice("LWSSTATS_C_SERVICE_ENTRY: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_C_SERVICE_ENTRY));
- lwsl_notice("LWSSTATS_B_READ: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_B_READ));
- lwsl_notice("LWSSTATS_B_WRITE: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_B_WRITE));
- lwsl_notice("LWSSTATS_B_PARTIALS_ACCEPTED_PARTS: %8llu\n", (unsigned long long)lws_stats_get(context, LWSSTATS_B_PARTIALS_ACCEPTED_PARTS));
- lwsl_notice("LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY: %8llums\n", (unsigned long long)lws_stats_get(context, LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY) / 1000);
+ lwsl_notice("LWSSTATS_C_CONNECTIONS: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_CONNECTIONS));
+ lwsl_notice("LWSSTATS_C_API_CLOSE: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_API_CLOSE));
+ lwsl_notice("LWSSTATS_C_API_READ: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_API_READ));
+ lwsl_notice("LWSSTATS_C_API_LWS_WRITE: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_API_LWS_WRITE));
+ lwsl_notice("LWSSTATS_C_API_WRITE: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_API_WRITE));
+ lwsl_notice("LWSSTATS_C_WRITE_PARTIALS: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_WRITE_PARTIALS));
+ lwsl_notice("LWSSTATS_C_WRITEABLE_CB_REQ: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_WRITEABLE_CB_REQ));
+ lwsl_notice("LWSSTATS_C_WRITEABLE_CB_EFF_REQ: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_WRITEABLE_CB_EFF_REQ));
+ lwsl_notice("LWSSTATS_C_WRITEABLE_CB: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_WRITEABLE_CB));
+ lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPT_SPIN));
+ lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_FAILED: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNECTIONS_FAILED));
+ lwsl_notice("LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED));
+ lwsl_notice("LWSSTATS_C_SSL_CONNS_HAD_RX: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNS_HAD_RX));
+ lwsl_notice("LWSSTATS_C_PEER_LIMIT_AH_DENIED: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_PEER_LIMIT_AH_DENIED));
+ lwsl_notice("LWSSTATS_C_PEER_LIMIT_WSI_DENIED: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_PEER_LIMIT_WSI_DENIED));
+
+ lwsl_notice("LWSSTATS_C_TIMEOUTS: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_TIMEOUTS));
+ lwsl_notice("LWSSTATS_C_SERVICE_ENTRY: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_C_SERVICE_ENTRY));
+ lwsl_notice("LWSSTATS_B_READ: %8llu\n",
+ (unsigned long long)lws_stats_get(context, LWSSTATS_B_READ));
+ lwsl_notice("LWSSTATS_B_WRITE: %8llu\n",
+ (unsigned long long)lws_stats_get(context, LWSSTATS_B_WRITE));
+ lwsl_notice("LWSSTATS_B_PARTIALS_ACCEPTED_PARTS: %8llu\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_B_PARTIALS_ACCEPTED_PARTS));
+ lwsl_notice("LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY: %8llums\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY) / 1000);
if (lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED))
lwsl_notice(" Avg accept delay: %8llums\n",
- (unsigned long long)(lws_stats_get(context, LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY) /
- lws_stats_get(context, LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED)) / 1000);
- lwsl_notice("LWSSTATS_MS_SSL_RX_DELAY: %8llums\n", (unsigned long long)lws_stats_get(context, LWSSTATS_MS_SSL_RX_DELAY) / 1000);
+ (unsigned long long)(lws_stats_get(context,
+ LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY) /
+ lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED)) / 1000);
+ lwsl_notice("LWSSTATS_MS_SSL_RX_DELAY: %8llums\n",
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_MS_SSL_RX_DELAY) / 1000);
if (lws_stats_get(context, LWSSTATS_C_SSL_CONNS_HAD_RX))
lwsl_notice(" Avg accept-rx delay: %8llums\n",
- (unsigned long long)(lws_stats_get(context, LWSSTATS_MS_SSL_RX_DELAY) /
- lws_stats_get(context, LWSSTATS_C_SSL_CONNS_HAD_RX)) / 1000);
+ (unsigned long long)(lws_stats_get(context,
+ LWSSTATS_MS_SSL_RX_DELAY) /
+ lws_stats_get(context,
+ LWSSTATS_C_SSL_CONNS_HAD_RX)) / 1000);
lwsl_notice("LWSSTATS_MS_WRITABLE_DELAY: %8lluus\n",
- (unsigned long long)lws_stats_get(context, LWSSTATS_MS_WRITABLE_DELAY));
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_MS_WRITABLE_DELAY));
lwsl_notice("LWSSTATS_MS_WORST_WRITABLE_DELAY: %8lluus\n",
- (unsigned long long)lws_stats_get(context, LWSSTATS_MS_WORST_WRITABLE_DELAY));
+ (unsigned long long)lws_stats_get(context,
+ LWSSTATS_MS_WORST_WRITABLE_DELAY));
if (lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB))
lwsl_notice(" Avg writable delay: %8lluus\n",
- (unsigned long long)(lws_stats_get(context, LWSSTATS_MS_WRITABLE_DELAY) /
+ (unsigned long long)(lws_stats_get(context,
+ LWSSTATS_MS_WRITABLE_DELAY) /
lws_stats_get(context, LWSSTATS_C_WRITEABLE_CB)));
- lwsl_notice("Simultaneous SSL restriction: %8d/%d/%d\n", context->simultaneous_ssl,
- context->simultaneous_ssl_restriction, context->ssl_gate_accepts);
+ lwsl_notice("Simultaneous SSL restriction: %8d/%d/%d\n",
+ context->simultaneous_ssl,
+ context->simultaneous_ssl_restriction,
+ context->ssl_gate_accepts);
- lwsl_notice("Live wsi: %8d\n", context->count_wsi_allocated);
+ lwsl_notice("Live wsi: %8d\n",
+ context->count_wsi_allocated);
context->updated = 1;
while (v) {
if (v->lserv_wsi) {
- struct lws_context_per_thread *pt = &context->pt[(int)v->lserv_wsi->tsi];
+ struct lws_context_per_thread *pt =
+ &context->pt[(int)v->lserv_wsi->tsi];
struct lws_pollfd *pfd;
pfd = &pt->fds[v->lserv_wsi->position_in_fds_table];
lwsl_notice(" Listen port %d actual POLLIN: %d\n",
- v->listen_port, (int)pfd->events & LWS_POLLIN);
+ v->listen_port,
+ (int)pfd->events & LWS_POLLIN);
}
v = v->vhost_next;
@@ -2986,7 +3052,8 @@ lws_stats_log_dump(struct lws_context *context)
for (n = 0; n < (int)context->pl_hash_elements; n++) {
char buf[72];
- lws_start_foreach_llp(struct lws_peer **, peer, context->pl_hash_table[n]) {
+ lws_start_foreach_llp(struct lws_peer **, peer,
+ context->pl_hash_table[n]) {
struct lws_peer *df = *peer;
if (!lws_plat_inet_ntop(df->af, df->addr, buf,
diff --git a/lib/output.c b/lib/output.c
index 411a1d4027d21e55e1e0e4d51183394271db707a..957756ff1788d955e03edd5e424220d095c80517 100644
--- a/lib/output.c
+++ b/lib/output.c
@@ -24,12 +24,6 @@
static int
lws_0405_frame_mask_generate(struct lws *wsi)
{
-#if 0
- wsi->u.ws.mask[0] = 0;
- wsi->u.ws.mask[1] = 0;
- wsi->u.ws.mask[2] = 0;
- wsi->u.ws.mask[3] = 0;
-#else
int n;
/* fetch the per-frame nonce */
@@ -39,7 +33,7 @@ lws_0405_frame_mask_generate(struct lws *wsi)
SYSTEM_RANDOM_FILEPATH, n);
return 1;
}
-#endif
+
/* start masking from first byte of masking key buffer */
wsi->u.ws.mask_idx = 0;
@@ -72,12 +66,12 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len)
strncpy(dump, (char *)buf, sizeof(dump) - 1);
dump[sizeof(dump) - 1] = '\0';
#if defined(LWS_WITH_ESP8266)
- lwsl_err("****** %p: Sending new %lu (%s), pending truncated ...\n",
+ lwsl_err("** %p: Sending new %lu (%s), pending truncated ...\n",
wsi, (unsigned long)len, dump);
#else
- lwsl_err("****** %p: Sending new %lu (%s), pending truncated ...\n"
- " It's illegal to do an lws_write outside of\n"
- " the writable callback: fix your code\n",
+ lwsl_err("** %p: Sending new %lu (%s), pending truncated ...\n"
+ " It's illegal to do an lws_write outside of\n"
+ " the writable callback: fix your code\n",
wsi, (unsigned long)len, dump);
#endif
assert(0);
@@ -140,11 +134,11 @@ handle_truncated_send:
wsi->trunc_len -= n;
if (!wsi->trunc_len) {
- lwsl_info("***** %p partial send completed\n", wsi);
+ lwsl_info("** %p partial send completed\n", wsi);
/* done with it, but don't free it */
n = (int)real_len;
if (wsi->state == LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE) {
- lwsl_info("***** %p signalling to close now\n", wsi);
+ lwsl_info("** %p signalling to close now\n", wsi);
return -1; /* retry closing now */
}
}
@@ -177,7 +171,8 @@ handle_truncated_send:
lws_free(wsi->trunc_alloc);
wsi->trunc_alloc_len = (unsigned int)(real_len - n);
- wsi->trunc_alloc = lws_malloc(real_len - n, "truncated send alloc");
+ wsi->trunc_alloc = lws_malloc(real_len - n,
+ "truncated send alloc");
if (!wsi->trunc_alloc) {
lwsl_err("truncated send: unable to malloc %lu\n",
(unsigned long)(real_len - n));
@@ -314,7 +309,8 @@ LWS_VISIBLE int lws_write(struct lws *wsi, unsigned char *buf, size_t len,
lwsl_debug("drain len %d\n", (int)eff_buf.token_len);
/* extension requires further draining */
wsi->u.ws.tx_draining_ext = 1;
- wsi->u.ws.tx_draining_ext_list = pt->tx_draining_ext_list;
+ wsi->u.ws.tx_draining_ext_list =
+ pt->tx_draining_ext_list;
pt->tx_draining_ext_list = wsi;
/* we must come back to do more */
lws_callback_on_writable(wsi);
@@ -487,7 +483,8 @@ send_raw:
n = LWS_H2_FRAME_TYPE_HEADERS;
if (!(wp & LWS_WRITE_NO_FIN))
flags = LWS_H2_FLAG_END_HEADERS;
- if (wsi->u.h2.send_END_STREAM || (wp & LWS_WRITE_H2_STREAM_END)) {
+ if (wsi->u.h2.send_END_STREAM ||
+ (wp & LWS_WRITE_H2_STREAM_END)) {
flags |= LWS_H2_FLAG_END_STREAM;
wsi->u.h2.send_END_STREAM = 1;
}
@@ -497,7 +494,8 @@ send_raw:
n = LWS_H2_FRAME_TYPE_CONTINUATION;
if (!(wp & LWS_WRITE_NO_FIN))
flags = LWS_H2_FLAG_END_HEADERS;
- if (wsi->u.h2.send_END_STREAM || (wp & LWS_WRITE_H2_STREAM_END)) {
+ if (wsi->u.h2.send_END_STREAM ||
+ (wp & LWS_WRITE_H2_STREAM_END)) {
flags |= LWS_H2_FLAG_END_STREAM;
wsi->u.h2.send_END_STREAM = 1;
}
@@ -510,12 +508,14 @@ send_raw:
lwsl_info("%s: wsi %p: tx_content_remain = %llu\n", __func__, wsi,
(unsigned long long)wsi->u.http.tx_content_remain);
if (!wsi->u.http.tx_content_remain) {
- lwsl_info("%s: selecting final write mode\n", __func__);
+ lwsl_info("%s: selecting final write mode\n",
+ __func__);
wp = LWS_WRITE_HTTP_FINAL;
}
}
- if ((wp & 0x1f) == LWS_WRITE_HTTP_FINAL || (wp & LWS_WRITE_H2_STREAM_END)) {
+ if ((wp & 0x1f) == LWS_WRITE_HTTP_FINAL ||
+ (wp & LWS_WRITE_H2_STREAM_END)) {
//lws_get_network_wsi(wsi)->u.h2.END_STREAM) {
lwsl_info("%s: setting END_STREAM\n", __func__);
flags |= LWS_H2_FLAG_END_STREAM;
@@ -609,7 +609,8 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
#if defined(LWS_WITH_RANGES)
if (wsi->u.http.range.count_ranges && !wsi->u.http.range.inside) {
- lwsl_notice("%s: doing range start %llu\n", __func__, wsi->u.http.range.start);
+ lwsl_notice("%s: doing range start %llu\n", __func__,
+ wsi->u.http.range.start);
if ((long long)lws_vfs_file_seek_cur(wsi->u.http.fop_fd,
wsi->u.http.range.start -
@@ -619,7 +620,9 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
wsi->u.http.filepos = wsi->u.http.range.start;
if (wsi->u.http.range.count_ranges > 1) {
- n = lws_snprintf((char *)p, context->pt_serv_buf_size - LWS_H2_FRAME_HEADER_LENGTH,
+ n = lws_snprintf((char *)p,
+ context->pt_serv_buf_size -
+ LWS_H2_FRAME_HEADER_LENGTH,
"_lws\x0d\x0a"
"Content-Type: %s\x0d\x0a"
"Content-Range: bytes %llu-%llu/%llu\x0d\x0a"
@@ -700,8 +703,9 @@ LWS_VISIBLE int lws_serve_http_file_fragment(struct lws *wsi)
args.final = wsi->u.http.filepos + n ==
wsi->u.http.filelen;
if (user_callback_handle_rxflow(
- wsi->vhost->protocols[(int)wsi->protocol_interpret_idx].callback, wsi,
- LWS_CALLBACK_PROCESS_HTML,
+ wsi->vhost->protocols[
+ (int)wsi->protocol_interpret_idx].callback,
+ wsi, LWS_CALLBACK_PROCESS_HTML,
wsi->user_space, &args, 0) < 0)
goto file_had_it;
n = args.len;
diff --git a/lib/pollfd.c b/lib/pollfd.c
index 18b8c73b18ba9de36c497de514c6ff8ecb23a4f7..6503f866b77a7993e6c060ff63f41ec109af65a6 100644
--- a/lib/pollfd.c
+++ b/lib/pollfd.c
@@ -135,8 +135,9 @@ _lws_change_pollfd(struct lws *wsi, int _and, int _or, struct lws_pollargs *pa)
return 0;
if (wsi->vhost &&
- wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_CHANGE_MODE_POLL_FD,
- wsi->user_space, (void *)pa, 0)) {
+ wsi->vhost->protocols[0].callback(wsi,
+ LWS_CALLBACK_CHANGE_MODE_POLL_FD,
+ wsi->user_space, (void *)pa, 0)) {
ret = -1;
goto bail;
}
@@ -347,7 +348,7 @@ remove_wsi_socket_from_fds(struct lws *wsi)
/* end guy's "position in fds table" is now the deletion guy's old one */
end_wsi = wsi_from_fd(context, v);
if (!end_wsi) {
- lwsl_err("no wsi found for sock fd %d at pos %d, pt->fds_count=%d\n",
+ lwsl_err("no wsi found for fd %d at pos %d, pt->fds_count=%d\n",
(int)pt->fds[m].fd, m, pt->fds_count);
assert(0);
} else
@@ -398,7 +399,7 @@ lws_change_pollfd(struct lws *wsi, int _and, int _or)
if (wsi->vhost &&
wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_LOCK_POLL,
- wsi->user_space, (void *) &pa, 0))
+ wsi->user_space, (void *) &pa, 0))
return -1;
pt = &context->pt[(int)wsi->tsi];
@@ -452,7 +453,8 @@ lws_callback_on_writable(struct lws *wsi)
#if defined(LWS_WITH_STATS)
if (!wsi->active_writable_req_us) {
wsi->active_writable_req_us = time_in_microseconds();
- lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITEABLE_CB_EFF_REQ, 1);
+ lws_stats_atomic_bump(wsi->context, pt,
+ LWSSTATS_C_WRITEABLE_CB_EFF_REQ, 1);
}
#endif
@@ -478,7 +480,8 @@ lws_callback_on_writable(struct lws *wsi)
* Delay waiting for our POLLOUT until peer indicates he has
* space for more using tx window command in http2 layer
*/
- lwsl_notice("%s: %p: skint (%d)\n", __func__, wsi, wsi->u.h2.tx_cr);
+ lwsl_notice("%s: %p: skint (%d)\n", __func__, wsi,
+ wsi->u.h2.tx_cr);
wsi->u.h2.skint = 1;
return 0;
}
@@ -508,7 +511,8 @@ network_sock:
return 1;
if (wsi->position_in_fds_table < 0) {
- lwsl_debug("%s: failed to find socket %d\n", __func__, wsi->desc.sockfd);
+ lwsl_debug("%s: failed to find socket %d\n", __func__,
+ wsi->desc.sockfd);
return -1;
}
@@ -600,7 +604,8 @@ lws_callback_on_writable_all_protocol_vhost(const struct lws_vhost *vhost,
assert(wsi->protocol == protocol);
assert(*wsi->same_vh_protocol_prev == wsi);
if (wsi->same_vh_protocol_next)
- assert(wsi->same_vh_protocol_next->same_vh_protocol_prev ==
+ assert(wsi->same_vh_protocol_next->
+ same_vh_protocol_prev ==
&wsi->same_vh_protocol_next);
lws_callback_on_writable(wsi);
diff --git a/lib/server/ssl-server.c b/lib/server/ssl-server.c
index cd1044da4f3a7560225efa820097d916719c1546..66edb066ab1a8949356ac550bfb0ac613995c327 100644
--- a/lib/server/ssl-server.c
+++ b/lib/server/ssl-server.c
@@ -125,7 +125,8 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
if (accept_fd == LWS_SOCK_INVALID)
assert(0);
if (context->simultaneous_ssl_restriction &&
- context->simultaneous_ssl >= context->simultaneous_ssl_restriction) {
+ context->simultaneous_ssl >=
+ context->simultaneous_ssl_restriction) {
lwsl_notice("unable to deal with SSL connection\n");
return 1;
}
@@ -137,7 +138,8 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
}
if (context->simultaneous_ssl_restriction &&
- ++context->simultaneous_ssl == context->simultaneous_ssl_restriction)
+ ++context->simultaneous_ssl ==
+ context->simultaneous_ssl_restriction)
/* that was the last allowed SSL connection */
lws_gate_accepts(context, 0);
#if defined(LWS_WITH_STATS)
@@ -185,7 +187,6 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
* SSL-level access control (eg, client-side certs) so leave
* it disabled unless you know it's not a problem for you
*/
-
if (n >= 1 && pt->serv_buf[0] >= ' ') {
/*
* TLS content-type for Handshake is 0x16, and
@@ -221,7 +222,7 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
* connection.
*/
if (lws_change_pollfd(wsi, 0, LWS_POLLIN)) {
- lwsl_info("%s: WANT_READ change_pollfd failed\n",
+ lwsl_info("%s: change_pollfd failed\n",
__func__);
return -1;
}
diff --git a/lib/service.c b/lib/service.c
index 1b9c2adf3d7596153672f0a85c88d30afda8f73a..e2efee887c7b0010712f6700dd3501074ba4ebda 100644
--- a/lib/service.c
+++ b/lib/service.c
@@ -503,7 +503,8 @@ next_child:
wsi2 = wa;
} while (wsi2 && *wsi2 && !lws_send_pipe_choked(wsi));
- lwsl_info("%s: %p: children waiting for POLLOUT service: %p\n", __func__, wsi, wsi->u.h2.child_list);
+ lwsl_info("%s: %p: children waiting for POLLOUT service: %p\n",
+ __func__, wsi, wsi->u.h2.child_list);
wsi2a = wsi->u.h2.child_list;
while (wsi2a) {
if (wsi2a->u.h2.requested_POLLOUT)
@@ -631,7 +632,8 @@ int lws_rxflow_cache(struct lws *wsi, unsigned char *buf, int n, int len)
buf += n;
len -= n;
assert ((char *)buf >= (char *)h2n->rx_scratch &&
- (char *)&buf[len] <= (char *)&h2n->rx_scratch[LWS_H2_RX_SCRATCH_SIZE]);
+ (char *)&buf[len] <=
+ (char *)&h2n->rx_scratch[LWS_H2_RX_SCRATCH_SIZE]);
h2n->rx_scratch_pos = lws_ptr_diff(buf, h2n->rx_scratch);
h2n->rx_scratch_len = len;
@@ -902,7 +904,8 @@ spin_chunks:
if (user_callback_handle_rxflow(wsi->protocol->callback,
wsi, LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ,
wsi->user_space, *buf, n)) {
- lwsl_debug("%s: LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ returned -1\n", __func__);
+ lwsl_debug("%s: RECEIVE_CLIENT_HTTP_READ returned -1\n",
+ __func__);
return -1;
}
@@ -958,7 +961,8 @@ lws_is_ws_with_ext(struct lws *wsi)
}
LWS_VISIBLE int
-lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int tsi)
+lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd,
+ int tsi)
{
struct lws_context_per_thread *pt = &context->pt[tsi];
lws_sockfd_type our_fd = 0, tmp_fd;
@@ -1032,7 +1036,7 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int t
if (tmp_fd == our_fd)
/* it was the guy we came to service! */
timed_out = 1;
- /* he's gone, no need to mark as handled */
+ /* he's gone, no need to mark as handled */
}
wsi = wsi1;
}
@@ -1143,13 +1147,17 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int t
wsi->u.ws.time_next_ping_check &&
wsi->u.ws.time_next_ping_check < now) {
- lwsl_info("requesting ping-pong on wsi %p\n", wsi);
+ lwsl_info("req pp on wsi %p\n",
+ wsi);
wsi->u.ws.send_check_ping = 1;
- lws_set_timeout(wsi, PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING,
- context->timeout_secs);
+ lws_set_timeout(wsi,
+ PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING,
+ context->timeout_secs);
lws_callback_on_writable(wsi);
- wsi->u.ws.time_next_ping_check = now +
- wsi->context->ws_ping_pong_interval;
+ wsi->u.ws.time_next_ping_check =
+ now +
+ wsi->context->
+ ws_ping_pong_interval;
}
wsi = wsi->same_vh_protocol_next;
}
@@ -1432,8 +1440,9 @@ lws_service_fd_tsi(struct lws_context *context, struct lws_pollfd *pollfd, int t
struct lws_h2_netconn *h2n = wsi->u.h2.h2n;
if (h2n->rx_scratch_len) {
- lwsl_info("%s: %p: resuming h2 rx_scratch pos = %d len = %d\n",
- __func__, wsi, h2n->rx_scratch_pos, h2n->rx_scratch_len);
+ lwsl_info("%s: %p: h2 rx pos = %d len = %d\n",
+ __func__, wsi, h2n->rx_scratch_pos,
+ h2n->rx_scratch_len);
eff_buf.token = (char *)h2n->rx_scratch +
h2n->rx_scratch_pos;
eff_buf.token_len = h2n->rx_scratch_len;
@@ -1469,15 +1478,20 @@ read:
} else {
if (wsi->mode != LWSCM_HTTP_CLIENT_ACCEPTED) {
/*
- * extension may not consume everything (eg, pmd may be constrained
- * as to what it can output...) has to go in per-wsi rx buf area.
+ * extension may not consume everything
+ * (eg, pmd may be constrained
+ * as to what it can output...) has to go in
+ * per-wsi rx buf area.
* Otherwise in large temp serv_buf area.
*/
#if defined(LWS_WITH_HTTP2)
if (wsi->upgraded_to_http2) {
if (!wsi->u.h2.h2n->rx_scratch) {
- wsi->u.h2.h2n->rx_scratch = lws_malloc(LWS_H2_RX_SCRATCH_SIZE, "h2 rx scratch");
+ wsi->u.h2.h2n->rx_scratch =
+ lws_malloc(
+ LWS_H2_RX_SCRATCH_SIZE,
+ "h2 rx scratch");
if (!wsi->u.h2.h2n->rx_scratch)
goto close_and_handled;
}
@@ -1488,24 +1502,30 @@ read:
{
eff_buf.token = (char *)pt->serv_buf;
if (lws_is_ws_with_ext(wsi)) {
- eff_buf.token_len = wsi->u.ws.rx_ubuf_alloc;
+ eff_buf.token_len =
+ wsi->u.ws.rx_ubuf_alloc;
} else {
- eff_buf.token_len = context->pt_serv_buf_size;
+ eff_buf.token_len =
+ context->pt_serv_buf_size;
}
- if ((unsigned int)eff_buf.token_len > context->pt_serv_buf_size)
- eff_buf.token_len = context->pt_serv_buf_size;
+ if ((unsigned int)eff_buf.token_len >
+ context->pt_serv_buf_size)
+ eff_buf.token_len =
+ context->pt_serv_buf_size;
}
if ((int)pending > eff_buf.token_len)
pending = eff_buf.token_len;
eff_buf.token_len = lws_ssl_capable_read(wsi,
- (unsigned char *)eff_buf.token, pending ? (int)pending :
+ (unsigned char *)eff_buf.token,
+ pending ? (int)pending :
eff_buf.token_len);
switch (eff_buf.token_len) {
case 0:
- lwsl_info("%s: zero length read\n", __func__);
+ lwsl_info("%s: zero length read\n",
+ __func__);
goto close_and_handled;
case LWS_SSL_CAPABLE_MORE_SERVICE:
lwsl_info("SSL Capable more service\n");
diff --git a/lib/tls/tls.c b/lib/tls/tls.c
index e804fb0662043e0eccf064227af17be4ebb566ab..81dc0e231ad550999e1ad498ae85e3d40ebf5642 100644
--- a/lib/tls/tls.c
+++ b/lib/tls/tls.c
@@ -110,10 +110,10 @@ lws_gate_accepts(struct lws_context *context, int on)
#endif
while (v) {
- if (v->use_ssl && v->lserv_wsi) /* gate ability to accept incoming connections */
- if (lws_change_pollfd(v->lserv_wsi, (LWS_POLLIN) * !on,
- (LWS_POLLIN) * on))
- lwsl_info("Unable to set accept POLLIN %d\n", on);
+ if (v->use_ssl && v->lserv_wsi &&
+ lws_change_pollfd(v->lserv_wsi, (LWS_POLLIN) * !on,
+ (LWS_POLLIN) * on))
+ lwsl_info("Unable to set accept POLLIN %d\n", on);
v = v->vhost_next;
}