|
44 | 44 | #include "mysql/components/services/bits/my_io_bits.h" |
45 | 45 | #include "mysql/components/services/bits/my_thread_bits.h" |
46 | 46 | #include "mysql/components/services/bits/mysql_socket_bits.h" |
| 47 | +#include "mysql_com.h" |
47 | 48 |
|
48 | 49 | #include "mysql/psi/mysql_socket.h" |
49 | 50 |
|
@@ -134,9 +135,11 @@ enum enum_vio_io_event { |
134 | 135 | VIO_IO_EVENT_CONNECT |
135 | 136 | }; |
136 | 137 |
|
137 | | -#define VIO_SOCKET_ERROR ((size_t)-1) |
138 | | -#define VIO_SOCKET_WANT_READ ((size_t)-2) |
139 | | -#define VIO_SOCKET_WANT_WRITE ((size_t)-3) |
| 138 | +#define VIO_SOCKET_ERROR ((ssize_t)-1) |
| 139 | +#define VIO_SOCKET_WANT_READ ((ssize_t)-2) |
| 140 | +#define VIO_SOCKET_WANT_WRITE ((ssize_t)-3) |
| 141 | +#define VIO_SOCKET_READ_TIMEOUT ((ssize_t)-4) |
| 142 | +#define VIO_SOCKET_WRITE_TIMEOUT ((ssize_t)-5) |
140 | 143 |
|
141 | 144 | #define VIO_LOCALHOST 1 /* a localhost connection */ |
142 | 145 | #define VIO_BUFFERED_READ 2 /* use buffered read */ |
@@ -190,16 +193,16 @@ my_socket vio_fd(MYSQL_VIO vio); |
190 | 193 | /* Remote peer's address and name in text form */ |
191 | 194 | bool vio_peer_addr(MYSQL_VIO vio, char *buf, uint16 *port, size_t buflen); |
192 | 195 | /* Wait for an I/O event notification. */ |
193 | | -int vio_io_wait(MYSQL_VIO vio, enum enum_vio_io_event event, int timeout); |
| 196 | +int vio_io_wait(MYSQL_VIO vio, enum enum_vio_io_event event, timeout_t timeout); |
194 | 197 | bool vio_is_connected(MYSQL_VIO vio); |
195 | 198 | #ifndef NDEBUG |
196 | 199 | ssize_t vio_pending(MYSQL_VIO vio); |
197 | 200 | #endif |
198 | 201 | /* Set timeout for a network operation. */ |
199 | | -int vio_timeout(MYSQL_VIO vio, uint which, int timeout_sec); |
| 202 | +int vio_timeout(MYSQL_VIO vio, uint which, timeout_t timeout); |
200 | 203 | /* Connect to a peer. */ |
201 | 204 | bool vio_socket_connect(MYSQL_VIO vio, struct sockaddr *addr, socklen_t len, |
202 | | - bool nonblocking, int timeout, |
| 205 | + bool nonblocking, timeout_t timeout, |
203 | 206 | bool *connect_done = nullptr); |
204 | 207 |
|
205 | 208 | bool vio_get_normalized_ip_string(const struct sockaddr *addr, |
@@ -330,10 +333,10 @@ struct Vio { |
330 | 333 | bool localhost = {false}; /* Are we from localhost? */ |
331 | 334 | enum_vio_type type = {NO_VIO_TYPE}; /* Type of connection */ |
332 | 335 |
|
333 | | - int read_timeout = {-1}; /* Timeout value (ms) for read ops. */ |
334 | | - int write_timeout = {-1}; /* Timeout value (ms) for write ops. */ |
335 | | - int retry_count = {1}; /* Retry count */ |
336 | | - bool inactive = {false}; /* Connection has been shutdown */ |
| 336 | + timeout_t read_timeout = {UINT_MAX}; /* Timeout value (ms) for read ops. */ |
| 337 | + timeout_t write_timeout = {UINT_MAX}; /* Timeout value (ms) for write ops. */ |
| 338 | + int retry_count = {1}; /* Retry count */ |
| 339 | + bool inactive = {false}; /* Connection has been shutdown */ |
337 | 340 |
|
338 | 341 | struct sockaddr_storage local; /* Local internet address */ |
339 | 342 | struct sockaddr_storage remote; /* Remote internet address */ |
@@ -410,7 +413,7 @@ struct Vio { |
410 | 413 | int (*vioshutdown)(MYSQL_VIO) = {nullptr}; |
411 | 414 | bool (*is_connected)(MYSQL_VIO) = {nullptr}; |
412 | 415 | bool (*has_data)(MYSQL_VIO) = {nullptr}; |
413 | | - int (*io_wait)(MYSQL_VIO, enum enum_vio_io_event, int) = {nullptr}; |
| 416 | + int (*io_wait)(MYSQL_VIO, enum enum_vio_io_event, timeout_t) = {nullptr}; |
414 | 417 | bool (*connect)(MYSQL_VIO, struct sockaddr *, socklen_t, int) = {nullptr}; |
415 | 418 | #ifdef _WIN32 |
416 | 419 | #ifdef __clang__ |
|
0 commit comments