| 17 | } |
| 18 | |
| 19 | bool BaseConnection::SetSocketBlocking(SOCKET socket, bool isBlocking) { |
| 20 | #ifdef WINDOWS |
| 21 | u_long mode = isBlocking ? 0 : 1; |
| 22 | return ioctlsocket(socket, FIONBIO, &mode) == 0; |
| 23 | #else |
| 24 | int oldFlags = fcntl(socket, F_GETFL, 0); |
| 25 | if(oldFlags == -1) |
| 26 | return false; |
| 27 | auto flags = isBlocking ? (oldFlags & ~O_NONBLOCK) : (oldFlags | O_NONBLOCK); |
| 28 | return fcntl(socket, F_SETFL, flags) != -1; |
| 29 | #endif |
| 30 | } |
| 31 | |
| 32 | bool BaseConnection::SetSocketRWTimeout(SOCKET socket, uint32_t secs) { |
| 33 | #ifdef WINDOWS |
nothing calls this directly
no outgoing calls
no test coverage detected