| 191 | } |
| 192 | |
| 193 | bool setBlocking(JNIEnv* e, int d, bool blocking) |
| 194 | { |
| 195 | #ifdef PLATFORM_WINDOWS |
| 196 | u_long a = (blocking ? 0 : 1); |
| 197 | int r = ioctlsocket(d, FIONBIO, &a); |
| 198 | if (r != 0) { |
| 199 | throwIOException(e); |
| 200 | return false; |
| 201 | } |
| 202 | #else |
| 203 | int r = fcntl(d, |
| 204 | F_SETFL, |
| 205 | (blocking ? (fcntl(d, F_GETFL) & (~O_NONBLOCK)) |
| 206 | : (fcntl(d, F_GETFL) | O_NONBLOCK))); |
| 207 | if (r < 0) { |
| 208 | throwIOException(e); |
| 209 | return false; |
| 210 | } |
| 211 | #endif |
| 212 | return true; |
| 213 | } |
| 214 | |
| 215 | bool setTcpNoDelay(JNIEnv* e, int d, bool on) |
| 216 | { |
no test coverage detected