diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2022-05-17 03:09:40 +0200 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2022-05-17 03:09:40 +0200 |
commit | 986fb5638542a943a6d9cd0d38d73605a642c55a (patch) | |
tree | 814b15dc9132ac8f6daeeb43ae9f96426cf4aa50 | |
parent | 0a90969b83a45f1e6e69c116ec2a6284e47b1767 (diff) |
Add -2 return code to read() calls that may feature an EAGAIN
-rwxr-xr-x | vchat-tls.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/vchat-tls.c b/vchat-tls.c index a6e5e2d..8154521 100755 --- a/vchat-tls.c +++ b/vchat-tls.c | |||
@@ -464,7 +464,13 @@ ssize_t vc_tls_sendmessage(const void *buf, size_t size) { | |||
464 | } | 464 | } |
465 | 465 | ||
466 | ssize_t vc_tls_receivemessage(void *buf, size_t size) { | 466 | ssize_t vc_tls_receivemessage(void *buf, size_t size) { |
467 | return BIO_read (server_conn, buf, size); | 467 | ssize_t received = (ssize_t)BIO_read (server_conn, buf, size); |
468 | fprintf(stderr, "%zd\n", received); | ||
469 | if (received != 0) | ||
470 | return received; | ||
471 | if (BIO_should_retry(server_conn)) | ||
472 | return -2; | ||
473 | return 0; | ||
468 | } | 474 | } |
469 | 475 | ||
470 | void vc_tls_cleanup() { | 476 | void vc_tls_cleanup() { |