-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Since timeout was already set via setsockopt, we call wait_io_or_timeout() with a very small timeout (5ms) to get a more precise errno, which is used by OpenSSL's error function.
- Loading branch information
Showing
2 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -567,11 +567,13 @@ my_bool ma_tls_connect(MARIADB_TLS *ctls) | |
{ | ||
switch((SSL_get_error(ssl, rc))) { | ||
case SSL_ERROR_WANT_READ: | ||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, mysql->options.connect_timeout) < 1) | ||
/* use low timeout, see ma_tls_read */ | ||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, 5) < 1) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
azat
Contributor
|
||
try_connect= 0; | ||
break; | ||
case SSL_ERROR_WANT_WRITE: | ||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, mysql->options.connect_timeout) < 1) | ||
/* use low timeout, see ma_tls_read */ | ||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, 5) < 1) | ||
This comment has been minimized.
Sorry, something went wrong.
azat
Contributor
|
||
try_connect= 0; | ||
break; | ||
default: | ||
|
@@ -655,7 +657,10 @@ ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length) | |
int error= SSL_get_error((SSL *)ctls->ssl, rc); | ||
if (error != SSL_ERROR_WANT_READ) | ||
break; | ||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.read_timeout) < 1) | ||
/* To get a more precise error message than "resource temporary | ||
unavailable" (=errno 11) after read timeout occured, we check | ||
the socket status using a very small timeout (=5 ms) */ | ||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, 5) < 1) | ||
break; | ||
} | ||
if (rc <= 0) | ||
|
@@ -676,7 +681,8 @@ ssize_t ma_tls_write(MARIADB_TLS *ctls, const uchar* buffer, size_t length) | |
int error= SSL_get_error((SSL *)ctls->ssl, rc); | ||
if (error != SSL_ERROR_WANT_WRITE) | ||
break; | ||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.write_timeout) < 1) | ||
/* use low timeout, see ma_tls_read */ | ||
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, 5) < 1) | ||
break; | ||
} | ||
if (rc <= 0) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shouldn't gnutls has the same code? I.e. something like this