Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix return from kws_raw_write on fragmented frame sending #214

Merged
merged 4 commits into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/kws.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ KS_DECLARE(ks_ssize_t) kws_raw_write(kws_t *kws, void *data, ks_size_t bytes)
r = ssl_err * -1;
}

return r;
return r > 0 ? wrote : r;
}

do {
Expand Down Expand Up @@ -650,7 +650,7 @@ KS_DECLARE(ks_ssize_t) kws_raw_write(kws_t *kws, void *data, ks_size_t bytes)
//printf("wRITE FAIL: %s\n", strerror(errno));
//}

return r;
return r >= 0 ? wrote : r;
}

static void setup_socket(ks_socket_t sock)
Expand Down Expand Up @@ -1622,7 +1622,7 @@ KS_DECLARE(ks_ssize_t) kws_write_frame(kws_t *kws, kws_opcode_t oc, const void *

raw_ret = kws_raw_write(kws, bp, (hlen + bytes));

if (raw_ret != (ks_ssize_t) (hlen + bytes)) {
if (raw_ret <= 0 || raw_ret != (ks_ssize_t) (hlen + bytes)) {
return raw_ret;
}

Expand Down
Loading