MT#55283 handle lws partial writes

Looks like partial writes are handled automatically internally, but add
a request for a "writeable" callback anyway so we know when we can write
more.

Closes #1943

Change-Id: I86a8e1924febc0524b90dc6559753e12e0de9dfb
(cherry picked from commit 9db8925846)
(cherry picked from commit c5eed15b10)
mr12.5.1
Richard Fuchs 8 months ago
parent bd86b89c27
commit 16ca4c24ad

@ -328,16 +328,19 @@ static int websocket_dequeue(struct websocket_conn *wc) {
if (to_send) { if (to_send) {
if (to_send > 10000) if (to_send > 10000)
ilogs(http, LOG_DEBUG, "Writing %lu bytes to LWS", (unsigned long) to_send); ilogs(http, LOG_DEBUG, "Writing %zu bytes to LWS", to_send);
else else
ilogs(http, LOG_DEBUG, "Writing back to LWS: '%.*s'", ilogs(http, LOG_DEBUG, "Writing back to LWS: '%.*s'",
(int) to_send, wo->str->str + LWS_PRE); (int) to_send, wo->str->str + LWS_PRE);
ssize_t ret = lws_write(wsi, (unsigned char *) wo->str->str + LWS_PRE, ssize_t ret = lws_write(wsi, (unsigned char *) wo->str->str + LWS_PRE,
to_send, wo->protocol); to_send, wo->protocol);
if (ret != to_send) if (ret <= 0)
ilogs(http, LOG_ERR, "Invalid LWS write: %lu != %lu", ilogs(http, LOG_DEBUG, "Failed LWS write: %zd", ret);
(unsigned long) ret, else if (ret < to_send) {
(unsigned long) to_send); lws_callback_on_writable(wsi);
websocket_output_free(wo);
break;
}
if (wo->protocol == LWS_WRITE_HTTP) if (wo->protocol == LWS_WRITE_HTTP)
is_http = true; is_http = true;

Loading…
Cancel
Save