diff options
author | Georg Richter <georg@mariadb.com> | 2016-10-13 12:07:14 +0200 |
---|---|---|
committer | Georg Richter <georg@mariadb.com> | 2016-10-13 12:07:14 +0200 |
commit | 351e6c8ede92ce2c22b9e7dfe07f992d09661478 (patch) | |
tree | 99f95ff39c350cc68bdc7406a26793f6e75fcf0c /sql-common/mysql_async.c | |
parent | 9a0fdab9ffab032aaf70ebf1ed255480b850a462 (diff) | |
download | mariadb-git-10.2-good_bye_yassl.tar.gz |
- Replaced yassl by gnutls10.2-good_bye_yassl
TLS functionality is now handled in ma_tls_vio.c
- added new parameter ssl_passphrase for passphrase protected
keys
Diffstat (limited to 'sql-common/mysql_async.c')
-rw-r--r-- | sql-common/mysql_async.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c index decf48e0e69..f5f8c703cc3 100644 --- a/sql-common/mysql_async.c +++ b/sql-common/mysql_async.c @@ -29,6 +29,7 @@ #include "mysql_async.h" + #ifdef __WIN__ /* Windows does not support MSG_DONTWAIT for send()/recv(). So we need to ensure @@ -214,19 +215,29 @@ my_io_wait_async(struct mysql_async_context *b, enum enum_vio_io_event event, } -#ifdef HAVE_OPENSSL +#ifdef HAVE_TLS static my_bool -my_ssl_async_check_result(int res, struct mysql_async_context *b, SSL *ssl) +my_ssl_async_check_result(int res, struct mysql_async_context *b, + MA_TLS_SESSION ssl) { int ssl_err; b->events_to_wait_for= 0; if (res >= 0) return 1; +#if defined(HAVE_OPENSSL) ssl_err= SSL_get_error(ssl, res); if (ssl_err == SSL_ERROR_WANT_READ) b->events_to_wait_for|= MYSQL_WAIT_READ; else if (ssl_err == SSL_ERROR_WANT_WRITE) b->events_to_wait_for|= MYSQL_WAIT_WRITE; +#elif defined(HAVE_GNUTLS) + if (res == GNUTLS_E_AGAIN) + { + b->events_to_wait_for|= gnutls_record_get_direction(ssl) ? + MYSQL_WAIT_WRITE : MYSQL_WAIT_READ; + + } +#endif else return 1; if (b->suspend_resume_hook) @@ -238,33 +249,33 @@ my_ssl_async_check_result(int res, struct mysql_async_context *b, SSL *ssl) } int -my_ssl_read_async(struct mysql_async_context *b, SSL *ssl, +my_ssl_read_async(struct mysql_async_context *b, MA_TLS_SESSION ssl, void *buf, int size) { int res; for (;;) { - res= SSL_read(ssl, buf, size); + res= ma_tls_read(ssl, buf, size); if (my_ssl_async_check_result(res, b, ssl)) return res; } } int -my_ssl_write_async(struct mysql_async_context *b, SSL *ssl, +my_ssl_write_async(struct mysql_async_context *b, MA_TLS_SESSION ssl, const void *buf, int size) { int res; for (;;) { - res= SSL_write(ssl, buf, size); + res= ma_tls_write(ssl, buf, size); if (my_ssl_async_check_result(res, b, ssl)) return res; } } -#endif /* HAVE_OPENSSL */ +#endif /* HAVE_TLS */ /* Legacy support of the MariaDB 5.5 version, where timeouts where only in |