Browse Source

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 6 months ago
parent
commit
16ca4c24ad
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      daemon/websocket.c

+ 8
- 5
daemon/websocket.c View File

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


Loading…
Cancel
Save