51
51
#include <string.h>
52
52
#include <ma_common.h>
53
53
#include <ma_pvio.h>
54
- #ifdef HAVE_NONBLOCK
55
54
#include <mariadb_async.h>
56
55
#include <ma_context.h>
57
- #endif
58
56
59
57
/* callback functions for read/write */
60
58
LIST * pvio_callback = NULL ;
@@ -121,6 +119,8 @@ MARIADB_PVIO *ma_pvio_init(MA_PVIO_CINFO *cinfo)
121
119
if (pvio -> methods -> set_timeout )
122
120
{
123
121
pvio -> methods -> set_timeout (pvio , PVIO_CONNECT_TIMEOUT , cinfo -> mysql -> options .connect_timeout );
122
+ pvio -> methods -> set_timeout (pvio , PVIO_READ_TIMEOUT , cinfo -> mysql -> options .connect_timeout );
123
+ pvio -> methods -> set_timeout (pvio , PVIO_WRITE_TIMEOUT , cinfo -> mysql -> options .connect_timeout );
124
124
}
125
125
126
126
if (!(pvio -> cache = calloc (1 , PVIO_READ_AHEAD_CACHE_SIZE )))
@@ -177,7 +177,6 @@ my_bool ma_pvio_set_timeout(MARIADB_PVIO *pvio,
177
177
}
178
178
/* }}} */
179
179
180
- #ifdef HAVE_NONBLOCK
181
180
/* {{{ size_t ma_pvio_read_async */
182
181
static size_t ma_pvio_read_async (MARIADB_PVIO * pvio , uchar * buffer , size_t length )
183
182
{
@@ -213,22 +212,19 @@ static size_t ma_pvio_read_async(MARIADB_PVIO *pvio, uchar *buffer, size_t lengt
213
212
}
214
213
}
215
214
/* }}} */
216
- #endif
217
215
218
216
/* {{{ size_t ma_pvio_read */
219
217
size_t ma_pvio_read (MARIADB_PVIO * pvio , uchar * buffer , size_t length )
220
218
{
221
219
size_t r = -1 ;
222
220
if (!pvio )
223
221
return -1 ;
224
- #ifdef HAVE_NONBLOCK
225
222
if (IS_PVIO_ASYNC_ACTIVE (pvio ))
226
223
{
227
224
r = ma_pvio_read_async (pvio , buffer , length );
228
225
goto end ;
229
226
}
230
227
else
231
- #endif
232
228
{
233
229
if (IS_PVIO_ASYNC (pvio ))
234
230
{
@@ -242,7 +238,7 @@ size_t ma_pvio_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length)
242
238
}
243
239
244
240
/* secure connection */
245
- #ifdef HAVE_SSL
241
+ #ifdef HAVE_TLS
246
242
if (pvio -> ctls )
247
243
{
248
244
r = ma_pvio_tls_read (pvio -> ctls , buffer , length );
@@ -306,7 +302,6 @@ size_t ma_pvio_cache_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length)
306
302
}
307
303
/* }}} */
308
304
309
- #ifdef HAVE_NONBLOCK
310
305
/* {{{ size_t ma_pvio_write_async */
311
306
static size_t ma_pvio_write_async (MARIADB_PVIO * pvio , const uchar * buffer , size_t length )
312
307
{
@@ -336,7 +331,6 @@ static size_t ma_pvio_write_async(MARIADB_PVIO *pvio, const uchar *buffer, size_
336
331
}
337
332
}
338
333
/* }}} */
339
- #endif
340
334
341
335
/* {{{ size_t ma_pvio_write */
342
336
size_t ma_pvio_write (MARIADB_PVIO * pvio , const uchar * buffer , size_t length )
@@ -347,22 +341,20 @@ size_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length)
347
341
return -1 ;
348
342
349
343
/* secure connection */
350
- #ifdef HAVE_SSL
344
+ #ifdef HAVE_TLS
351
345
if (pvio -> ctls )
352
346
{
353
347
r = ma_pvio_tls_write (pvio -> ctls , buffer , length );
354
348
goto end ;
355
349
}
356
350
else
357
351
#endif
358
- #ifdef HAVE_NONBLOCK
359
352
if (IS_PVIO_ASYNC_ACTIVE (pvio ))
360
353
{
361
354
r = ma_pvio_write_async (pvio , buffer , length );
362
355
goto end ;
363
356
}
364
357
else
365
- #endif
366
358
{
367
359
if (IS_PVIO_ASYNC (pvio ))
368
360
{
@@ -388,7 +380,7 @@ size_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length)
388
380
void ma_pvio_close (MARIADB_PVIO * pvio )
389
381
{
390
382
/* free internal structures and close connection */
391
- #ifdef HAVE_SSL
383
+ #ifdef HAVE_TLS
392
384
if (pvio && pvio -> ctls )
393
385
{
394
386
ma_pvio_tls_close (pvio -> ctls );
@@ -414,7 +406,6 @@ my_bool ma_pvio_get_handle(MARIADB_PVIO *pvio, void *handle)
414
406
}
415
407
/* }}} */
416
408
417
- #ifdef HAVE_NONBLOCK
418
409
/* {{{ ma_pvio_wait_async */
419
410
static my_bool
420
411
ma_pvio_wait_async (struct mysql_async_context * b , enum enum_pvio_io_event event ,
@@ -446,17 +437,14 @@ ma_pvio_wait_async(struct mysql_async_context *b, enum enum_pvio_io_event event,
446
437
return (b -> events_occured & MYSQL_WAIT_TIMEOUT ) ? 0 : 1 ;
447
438
}
448
439
/* }}} */
449
- #endif
450
440
451
441
/* {{{ ma_pvio_wait_io_or_timeout */
452
442
int ma_pvio_wait_io_or_timeout (MARIADB_PVIO * pvio , my_bool is_read , int timeout )
453
443
{
454
- #ifdef HAVE_NONBLOCK
455
444
if (IS_PVIO_ASYNC_ACTIVE (pvio ))
456
445
return ma_pvio_wait_async (pvio -> mysql -> options .extension -> async_context ,
457
446
(is_read ) ? VIO_IO_EVENT_READ : VIO_IO_EVENT_WRITE ,
458
447
timeout );
459
- #endif
460
448
461
449
if (pvio && pvio -> methods -> wait_io_or_timeout )
462
450
return pvio -> methods -> wait_io_or_timeout (pvio , is_read , timeout );
@@ -504,7 +492,7 @@ my_bool ma_pvio_has_data(MARIADB_PVIO *pvio, ssize_t *data_len)
504
492
}
505
493
/* }}} */
506
494
507
- #ifdef HAVE_SSL
495
+ #ifdef HAVE_TLS
508
496
/* {{{ my_bool ma_pvio_start_ssl */
509
497
my_bool ma_pvio_start_ssl (MARIADB_PVIO * pvio )
510
498
{
0 commit comments