1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

asserts log which

Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
Andy Green 2016-05-13 10:27:48 +08:00
parent ecaed5ec94
commit 97164368dd
4 changed files with 28 additions and 8 deletions

View file

@ -107,8 +107,10 @@ lws_read(struct lws *wsi, unsigned char *buf, size_t len)
wsi->u.hdr.lextable_pos = 0;
/* fallthru */
case LWSS_HTTP_HEADERS:
assert(wsi->u.hdr.ah);
if (!wsi->u.hdr.ah) {
lwsl_err("%s: LWSS_HTTP_HEADERS: NULL ah\n", __func__);
assert(0);
}
lwsl_parser("issuing %d bytes to parser\n", (int)len);
if (lws_handshake_client(wsi, &buf, len))

View file

@ -308,8 +308,11 @@ lws_libuv_io(struct lws *wsi, int flags)
return;
}
assert((flags & (LWS_EV_START | LWS_EV_STOP)) &&
(flags & (LWS_EV_READ | LWS_EV_WRITE)));
if (!((flags & (LWS_EV_START | LWS_EV_STOP)) &&
(flags & (LWS_EV_READ | LWS_EV_WRITE)))) {
lwsl_err("%s: assert: flags %d", __func__, flags);
assert(0);
}
if (flags & LWS_EV_START) {
if (flags & LWS_EV_WRITE)

View file

@ -810,8 +810,15 @@ lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len)
char protocol_name[32];
char *p;
assert(len < 10000000);
assert(wsi->u.hdr.ah);
if (len >= 10000000) {
lwsl_err("%s: assert: len %ld\n", __func__, (long)len);
assert(0);
}
if (!wsi->u.hdr.ah) {
lwsl_err("%s: assert: NULL ah\n", __func__);
assert(0);
}
while (len--) {
wsi->more_rx_waiting = !!len;
@ -1562,7 +1569,12 @@ lws_server_socket_service(struct lws_context *context, struct lws *wsi,
goto try_pollout;
}
}
assert(ah->rxpos != ah->rxlen && ah->rxlen);
if (!(ah->rxpos != ah->rxlen && ah->rxlen)) {
lwsl_err("%s: assert: rxpos %d, rxlen %d\n",
__func__, ah->rxpos, ah->rxlen);
assert(0);
}
/* just ignore incoming if waiting for close */
if (wsi->state != LWSS_FLUSHING_STORED_SEND_BEFORE_CLOSE) {
n = lws_read(wsi, ah->rx + ah->rxpos,

View file

@ -408,7 +408,10 @@ lws_service_adjust_timeout(struct lws_context *context, int timeout_ms, int tsi)
for (n = 0; n < context->max_http_header_pool; n++)
if (pt->ah_pool[n].rxpos != pt->ah_pool[n].rxlen) {
/* any ah with pending rx must be attached to someone */
assert(pt->ah_pool[n].wsi);
if (!pt->ah_pool[n].wsi) {
lwsl_err("%s: assert: no wsi attached to ah\n", __func__);
assert(0);
}
return 0;
}