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

don't return -1 if the socket was closed #15771

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions exporting/send_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ void simple_connector_receive_response(int *sock, struct instance *instance)
// failed to receive data
if (errno != EAGAIN && errno != EWOULDBLOCK) {
netdata_log_error("EXPORTING: cannot receive data from '%s'.", instance->config.destination);
close(*sock);
*sock = -1;
}
}

Expand Down
5 changes: 5 additions & 0 deletions libnetdata/socket/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ ssize_t netdata_ssl_read(NETDATA_SSL *ssl, void *buf, size_t num) {

if(unlikely(bytes <= 0)) {
int err = SSL_get_error(ssl->conn, bytes);
if (err == SSL_ERROR_ZERO_RETURN) {
ssl->ssl_errno = err;
return 0;
}

if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
ssl->ssl_errno = err;
errno = EWOULDBLOCK;
Expand Down