Skip to content
Snippets Groups Projects
Commit c1a1e38d authored by Andy Green's avatar Andy Green
Browse files

LWS_WITH_STATS: only report ssl accept delay we have a start time for

parent 25e5a58a
No related branches found
No related tags found
No related merge requests found
......@@ -75,7 +75,7 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
}
#endif
#if defined(LWS_WITH_STATS)
if (!wsi->seen_rx) {
if (!wsi->seen_rx && wsi->accept_start_us) {
lws_stats_atomic_bump(wsi->context, pt,
LWSSTATS_MS_SSL_RX_DELAY,
time_in_microseconds() - wsi->accept_start_us);
......
......@@ -216,7 +216,7 @@ lws_ssl_capable_read(struct lws *wsi, unsigned char *buf, int len)
}
#endif
#if defined(LWS_WITH_STATS)
if (!wsi->seen_rx) {
if (!wsi->seen_rx && wsi->accept_start_us) {
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_MS_SSL_RX_DELAY,
time_in_microseconds() - wsi->accept_start_us);
lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_SSL_CONNS_HAD_RX, 1);
......
......@@ -312,6 +312,7 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
/* normal SSL connection processing path */
#if defined(LWS_WITH_STATS)
/* only set this the first time around */
if (!wsi->accept_start_us)
wsi->accept_start_us = time_in_microseconds();
#endif
......@@ -340,6 +341,7 @@ lws_server_socket_service_ssl(struct lws *wsi, lws_sockfd_type accept_fd)
lws_stats_atomic_bump(wsi->context, pt,
LWSSTATS_C_SSL_CONNECTIONS_ACCEPTED, 1);
#if defined(LWS_WITH_STATS)
if (wsi->accept_start_us)
lws_stats_atomic_bump(wsi->context, pt,
LWSSTATS_MS_SSL_CONNECTIONS_ACCEPTED_DELAY,
time_in_microseconds() - wsi->accept_start_us);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment