Skip to content

Commit

Permalink
sources/tls.c: eof error text improve (#716)
Browse files Browse the repository at this point in the history
When errno is 0, it means that client closed the connection

Signed-off-by: rkhapov <[email protected]>
(cherry picked from commit e4021d359980ed8e6cb86271672a0895e7aa5ae7)

Co-authored-by: rkhapov <[email protected]>
  • Loading branch information
rkhapov and rkhapov authored Nov 18, 2024
1 parent f081cf9 commit 8090ce8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion third_party/machinarium/sources/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ static inline void mm_tls_error(mm_io_t *io, int ssl_rc, char *fmt, ...)
} else if (ssl_rc == 0) {
error_str = "unexpected EOF (connection reset)";
} else if (ssl_rc < 0) {
error_str = strerror(mm_errno_get());
int errno_ = mm_errno_get();
if (errno_ != 0) {
error_str = strerror(errno_);
} else {
error_str =
"no bio underlying error (client closed the connection?)";
}
}

/* error message */
Expand Down

0 comments on commit 8090ce8

Please sign in to comment.