| 171 | */ |
| 172 | |
| 173 | static DWORD get_win32_connect_timeout(MYSQL *mysql) |
| 174 | { |
| 175 | DWORD timeout_ms; |
| 176 | uint timeout_sec; |
| 177 | |
| 178 | /* |
| 179 | A timeout of 0 means no timeout. Also, the connect_timeout |
| 180 | option value is in seconds, while WIN32 timeouts are in |
| 181 | milliseconds. Hence, check for a possible overflow. In case |
| 182 | of overflow, set to no timeout. |
| 183 | */ |
| 184 | timeout_sec= mysql->options.connect_timeout; |
| 185 | |
| 186 | if (!timeout_sec || (timeout_sec > INT_MAX/1000)) |
| 187 | timeout_ms= INFINITE; |
| 188 | else |
| 189 | timeout_ms= (DWORD) (timeout_sec * 1000); |
| 190 | |
| 191 | return timeout_ms; |
| 192 | } |
| 193 | |
| 194 | #endif |
| 195 | |