| 76 | } |
| 77 | |
| 78 | static bool socket_blocking(int fd, bool block) |
| 79 | { |
| 80 | #ifdef __WIN32 |
| 81 | u_long iMode = block ? 0 : 1; |
| 82 | return ioctlsocket(fd, FIONBIO, &iMode) == 0; |
| 83 | #else |
| 84 | int fl = fcntl(fd, F_GETFL); |
| 85 | int fl_new = block ? (fl & ~O_NONBLOCK) : (fl | O_NONBLOCK); |
| 86 | if(fl_new == fl) |
| 87 | return true; |
| 88 | return fcntl(fd, F_SETFL, fl_new) == 0; |
| 89 | #endif |
| 90 | } |
| 91 | |
| 92 | /* |
| 93 | * CSockAddr |
no outgoing calls
no test coverage detected