asserts log which
Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
85213516d3
commit
9c0cc42707
4 changed files with 28 additions and 8 deletions
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
18
lib/server.c
18
lib/server.c
|
@ -753,8 +753,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;
|
||||
|
@ -1504,7 +1511,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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue