1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Merge pull request #250 from azat-ch/wait_io_or_timeout-fixes

Fix usage of wait_io_or_timeout from TLS layers
This commit is contained in:
Georg Richter
2024-09-12 19:40:45 +02:00
committed by GitHub
2 changed files with 6 additions and 6 deletions

View File

@@ -1365,7 +1365,7 @@ ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
{ {
if (rc != GNUTLS_E_AGAIN && rc != GNUTLS_E_INTERRUPTED) if (rc != GNUTLS_E_AGAIN && rc != GNUTLS_E_INTERRUPTED)
break; break;
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.read_timeout) < 1) if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->timeout[PVIO_READ_TIMEOUT]) < 1)
break; break;
} }
if (rc <= 0) { if (rc <= 0) {
@@ -1384,7 +1384,7 @@ ssize_t ma_tls_write(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
{ {
if (rc != GNUTLS_E_AGAIN && rc != GNUTLS_E_INTERRUPTED) if (rc != GNUTLS_E_AGAIN && rc != GNUTLS_E_INTERRUPTED)
break; break;
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.write_timeout) < 1) if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->timeout[PVIO_WRITE_TIMEOUT]) < 1)
break; break;
} }
if (rc <= 0) { if (rc <= 0) {

View File

@@ -567,11 +567,11 @@ my_bool ma_tls_connect(MARIADB_TLS *ctls)
{ {
switch((SSL_get_error(ssl, rc))) { switch((SSL_get_error(ssl, rc))) {
case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_READ:
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, mysql->options.connect_timeout) < 1) if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->timeout[PVIO_CONNECT_TIMEOUT]) < 1)
try_connect= 0; try_connect= 0;
break; break;
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, mysql->options.connect_timeout) < 1) if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->timeout[PVIO_CONNECT_TIMEOUT]) < 1)
try_connect= 0; try_connect= 0;
break; break;
default: default:
@@ -655,7 +655,7 @@ ssize_t ma_tls_read(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
int error= SSL_get_error((SSL *)ctls->ssl, rc); int error= SSL_get_error((SSL *)ctls->ssl, rc);
if (error != SSL_ERROR_WANT_READ) if (error != SSL_ERROR_WANT_READ)
break; break;
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.read_timeout) < 1) if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->timeout[PVIO_READ_TIMEOUT]) < 1)
break; break;
} }
if (rc <= 0) if (rc <= 0)
@@ -676,7 +676,7 @@ ssize_t ma_tls_write(MARIADB_TLS *ctls, const uchar* buffer, size_t length)
int error= SSL_get_error((SSL *)ctls->ssl, rc); int error= SSL_get_error((SSL *)ctls->ssl, rc);
if (error != SSL_ERROR_WANT_WRITE) if (error != SSL_ERROR_WANT_WRITE)
break; break;
if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->mysql->options.write_timeout) < 1) if (pvio->methods->wait_io_or_timeout(pvio, TRUE, pvio->timeout[PVIO_WRITE_TIMEOUT]) < 1)
break; break;
} }
if (rc <= 0) if (rc <= 0)