|
44 | 44 | #include "mysql/components/services/my_io_bits.h" |
45 | 45 | #include "mysql/components/services/my_thread_bits.h" |
46 | 46 | #include "mysql/components/services/mysql_socket_bits.h" |
| 47 | +#include "mysql_com.h" |
47 | 48 |
|
48 | 49 | struct Vio; |
49 | 50 |
|
@@ -131,9 +132,11 @@ enum enum_vio_io_event { |
131 | 132 | VIO_IO_EVENT_CONNECT |
132 | 133 | }; |
133 | 134 |
|
134 | | -#define VIO_SOCKET_ERROR ((size_t)-1) |
135 | | -#define VIO_SOCKET_WANT_READ ((size_t)-2) |
136 | | -#define VIO_SOCKET_WANT_WRITE ((size_t)-3) |
| 135 | +#define VIO_SOCKET_ERROR ((ssize_t)-1) |
| 136 | +#define VIO_SOCKET_WANT_READ ((ssize_t)-2) |
| 137 | +#define VIO_SOCKET_WANT_WRITE ((ssize_t)-3) |
| 138 | +#define VIO_SOCKET_READ_TIMEOUT ((ssize_t)-4) |
| 139 | +#define VIO_SOCKET_WRITE_TIMEOUT ((ssize_t)-5) |
137 | 140 |
|
138 | 141 | #define VIO_LOCALHOST 1 /* a localhost connection */ |
139 | 142 | #define VIO_BUFFERED_READ 2 /* use buffered read */ |
@@ -186,16 +189,16 @@ my_socket vio_fd(MYSQL_VIO vio); |
186 | 189 | /* Remote peer's address and name in text form */ |
187 | 190 | bool vio_peer_addr(MYSQL_VIO vio, char *buf, uint16 *port, size_t buflen); |
188 | 191 | /* Wait for an I/O event notification. */ |
189 | | -int vio_io_wait(MYSQL_VIO vio, enum enum_vio_io_event event, int timeout); |
| 192 | +int vio_io_wait(MYSQL_VIO vio, enum enum_vio_io_event event, timeout_t timeout); |
190 | 193 | bool vio_is_connected(MYSQL_VIO vio); |
191 | 194 | #ifndef DBUG_OFF |
192 | 195 | ssize_t vio_pending(MYSQL_VIO vio); |
193 | 196 | #endif |
194 | 197 | /* Set timeout for a network operation. */ |
195 | | -int vio_timeout(MYSQL_VIO vio, uint which, int timeout_sec); |
| 198 | +int vio_timeout(MYSQL_VIO vio, uint which, timeout_t timeout); |
196 | 199 | /* Connect to a peer. */ |
197 | 200 | bool vio_socket_connect(MYSQL_VIO vio, struct sockaddr *addr, socklen_t len, |
198 | | - bool nonblocking, int timeout); |
| 201 | + bool nonblocking, timeout_t timeout); |
199 | 202 |
|
200 | 203 | bool vio_get_normalized_ip_string(const struct sockaddr *addr, |
201 | 204 | size_t addr_length, char *ip_string, |
@@ -345,10 +348,10 @@ struct Vio { |
345 | 348 | bool localhost = {false}; /* Are we from localhost? */ |
346 | 349 | enum_vio_type type = {NO_VIO_TYPE}; /* Type of connection */ |
347 | 350 |
|
348 | | - int read_timeout = {-1}; /* Timeout value (ms) for read ops. */ |
349 | | - int write_timeout = {-1}; /* Timeout value (ms) for write ops. */ |
350 | | - int retry_count = {1}; /* Retry count */ |
351 | | - bool inactive = {false}; /* Connection has been shutdown */ |
| 351 | + timeout_t read_timeout = {UINT_MAX}; /* Timeout value (ms) for read ops. */ |
| 352 | + timeout_t write_timeout = {UINT_MAX}; /* Timeout value (ms) for write ops. */ |
| 353 | + int retry_count = {1}; /* Retry count */ |
| 354 | + bool inactive = {false}; /* Connection has been shutdown */ |
352 | 355 |
|
353 | 356 | struct sockaddr_storage local; /* Local internet address */ |
354 | 357 | struct sockaddr_storage remote; /* Remote internet address */ |
@@ -415,7 +418,7 @@ struct Vio { |
415 | 418 | int (*vioshutdown)(MYSQL_VIO) = {nullptr}; |
416 | 419 | bool (*is_connected)(MYSQL_VIO) = {nullptr}; |
417 | 420 | bool (*has_data)(MYSQL_VIO) = {nullptr}; |
418 | | - int (*io_wait)(MYSQL_VIO, enum enum_vio_io_event, int) = {nullptr}; |
| 421 | + int (*io_wait)(MYSQL_VIO, enum enum_vio_io_event, timeout_t) = {nullptr}; |
419 | 422 | bool (*connect)(MYSQL_VIO, struct sockaddr *, socklen_t, int) = {nullptr}; |
420 | 423 | #ifdef _WIN32 |
421 | 424 | #ifdef __clang__ |
|
0 commit comments