diff options
author | Yossi Gottlieb <yossigo@gmail.com> | 2021-11-08 16:09:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-08 16:09:33 +0200 |
commit | a1aba4bf754fc6c650d37447b689ac4dea6baebf (patch) | |
tree | c8a0275327b1c59ae7b0a1d6bfe607e0cc06e249 /src/tls.c | |
parent | 48d870aed1a5c392f3c1b59db48bc15f9f43b963 (diff) | |
download | redis-a1aba4bf754fc6c650d37447b689ac4dea6baebf.tar.gz |
Fix EINTR test failures. (#9751)
* Clean up EINTR handling so EINTR will not change connection state to begin with.
* On TLS, catch EINTR and return it as-is before going through OpenSSL error handling (which seems to not distinguish it from EAGAIN).
Diffstat (limited to 'src/tls.c')
-rw-r--r-- | src/tls.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -750,7 +750,14 @@ static int connTLSWrite(connection *conn_, const void *data, size_t data_len) { if (conn->c.state != CONN_STATE_CONNECTED) return -1; ERR_clear_error(); ret = SSL_write(conn->ssl, data, data_len); - + /* If system call was interrupted, there's no need to go through the full + * OpenSSL error handling and just report this for the caller to retry the + * operation. + */ + if (errno == EINTR) { + conn->c.last_errno = EINTR; + return -1; + } if (ret <= 0) { WantIOType want = 0; if (!(ssl_err = handleSSLReturnCode(conn, ret, &want))) { @@ -781,6 +788,14 @@ static int connTLSRead(connection *conn_, void *buf, size_t buf_len) { if (conn->c.state != CONN_STATE_CONNECTED) return -1; ERR_clear_error(); ret = SSL_read(conn->ssl, buf, buf_len); + /* If system call was interrupted, there's no need to go through the full + * OpenSSL error handling and just report this for the caller to retry the + * operation. + */ + if (errno == EINTR) { + conn->c.last_errno = EINTR; + return -1; + } if (ret <= 0) { WantIOType want = 0; if (!(ssl_err = handleSSLReturnCode(conn, ret, &want))) { |