You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
CONC-377: Add IO Callback
Applied part of the patch from https://github.com/MariaDB/mariadb-connector-c/pull/71 The part for named pipes doesn't work, since wait_io was reworked by vvaintroub.
This commit is contained in:
@@ -71,6 +71,7 @@ struct st_mysql_options_extension {
|
||||
char *server_public_key;
|
||||
char *proxy_header;
|
||||
size_t proxy_header_len;
|
||||
int (*io_wait)(my_socket handle, my_bool is_read, int timeout);
|
||||
};
|
||||
|
||||
typedef struct st_connection_handler
|
||||
|
@@ -233,7 +233,8 @@ extern const char *SQLSTATE_UNKNOWN;
|
||||
MARIADB_OPT_MULTI_RESULTS,
|
||||
MARIADB_OPT_MULTI_STATEMENTS,
|
||||
MARIADB_OPT_INTERACTIVE,
|
||||
MARIADB_OPT_PROXY_HEADER
|
||||
MARIADB_OPT_PROXY_HEADER,
|
||||
MARIADB_OPT_IO_WAIT
|
||||
};
|
||||
|
||||
enum mariadb_value {
|
||||
|
@@ -3013,6 +3013,10 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
||||
case MYSQL_OPT_TLS_VERSION:
|
||||
OPT_SET_EXTENDED_VALUE_STR(&mysql->options, tls_version, (char *)arg1);
|
||||
break;
|
||||
case MARIADB_OPT_IO_WAIT:
|
||||
CHECK_OPT_EXTENSION_SET(&mysql->options);
|
||||
mysql->options.extension->io_wait = (int(*)(my_socket, my_bool, int))arg1;
|
||||
break;
|
||||
default:
|
||||
va_end(ap);
|
||||
return(-1);
|
||||
@@ -3227,6 +3231,9 @@ mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...)
|
||||
case MARIADB_OPT_CONNECTION_HANDLER:
|
||||
*((char **)arg)= mysql->options.extension ? mysql->options.extension->connection_handler : NULL;
|
||||
break;
|
||||
case MARIADB_OPT_IO_WAIT:
|
||||
*((int(**)(my_socket, my_bool, int))arg) = mysql->options.extension ? mysql->options.extension->io_wait : NULL;
|
||||
break;
|
||||
default:
|
||||
va_end(ap);
|
||||
return(-1);
|
||||
|
@@ -504,6 +504,14 @@ int pvio_socket_wait_io_or_timeout(MARIADB_PVIO *pvio, my_bool is_read, int time
|
||||
if (!pvio || !pvio->data)
|
||||
return 0;
|
||||
|
||||
if (pvio->mysql->options.extension &&
|
||||
pvio->mysql->options.extension->io_wait != NULL) {
|
||||
my_socket handle;
|
||||
if (pvio_socket_get_handle(pvio, &handle))
|
||||
return 0;
|
||||
return pvio->mysql->options.extension->io_wait(handle, is_read, timeout);
|
||||
}
|
||||
|
||||
csock= (struct st_pvio_socket *)pvio->data;
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
Reference in New Issue
Block a user