| 120 | #endif /* !WIN32 */ |
| 121 | |
| 122 | std::error_code set_non_blocking(const minifi::io::SocketDescriptor fd) noexcept { |
| 123 | #ifndef WIN32 |
| 124 | if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { |
| 125 | return { errno, std::generic_category() }; |
| 126 | } |
| 127 | #else |
| 128 | u_long iMode = 1; |
| 129 | if (ioctlsocket(fd, FIONBIO, &iMode) == SOCKET_ERROR) { |
| 130 | return { WSAGetLastError(), std::system_category() }; |
| 131 | } |
| 132 | #endif /* !WIN32 */ |
| 133 | return {}; |
| 134 | } |
| 135 | } // namespace |
| 136 | |
| 137 | namespace org { |