Faster version of evutil_make_socket_nonblocking for internal use. * * Requires that no F_SETFL flags were previously set on the fd. */
| 75 | * Requires that no F_SETFL flags were previously set on the fd. |
| 76 | */ |
| 77 | static int evutil_fast_socket_nonblocking(evutil_socket_t fd) { |
| 78 | #ifdef _WIN32 |
| 79 | return evutil_make_socket_nonblocking(fd); |
| 80 | #else |
| 81 | if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { |
| 82 | LogPrint(BCLog::ERROR, "evutil_fast_socket_nonblocking fcntl(%d, F_SETFL)\n", fd); |
| 83 | return -1; |
| 84 | } |
| 85 | return 0; |
| 86 | #endif |
| 87 | } |
| 88 | |
| 89 | /* Internal wrapper around 'socket' to provide Linux-style support for |
| 90 | * syscall-saving methods where available. |