Skip to content

Commit

Permalink
feat: ssl: clearer error message
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Sep 10, 2021
1 parent 1853463 commit 4ec4225
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/rtty.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ static int ssl_negotiated(struct rtty *rtty)
return 0;

if (ret == SSL_ERROR) {
log_err("ssl connect error(%d): %s\n", ssl_err_code, ssl_strerror(ssl_err_code, err_buf, sizeof(err_buf)));
log_err("ssl connect error: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf)));
return -1;
}

Expand All @@ -413,8 +413,7 @@ static int rtty_ssl_read(int fd, void *buf, size_t count, void *arg)

ret = ssl_read(rtty->ssl, buf, count);
if (ret == SSL_ERROR) {
log_err("ssl_read(%d): %s\n", ssl_err_code,
ssl_strerror(ssl_err_code, err_buf, sizeof(err_buf)));
log_err("ssl_read: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf)));
return P_FD_ERR;
}

Expand Down Expand Up @@ -490,8 +489,7 @@ static void on_net_write(struct ev_loop *loop, struct ev_io *w, int revents)

ret = ssl_write(rtty->ssl, buffer_data(b), buffer_length(b));
if (ret == SSL_ERROR) {
log_err("ssl_write(%d): %s\n", ssl_err_code,
ssl_strerror(ssl_err_code, err_buf, sizeof(err_buf)));
log_err("ssl_write: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf)));
goto err;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ssl
Submodule ssl updated 5 files
+5 −6 example-client.c
+5 −6 example-server.c
+4 −4 mbedtls.c
+19 −6 openssl.c
+1 −3 ssl.h

0 comments on commit 4ec4225

Please sign in to comment.