| 322 | |
| 323 | |
| 324 | int receiveBytes(Exception& ex, void* buffer, int length, int flags) { |
| 325 | ASSERT_RETURN(_initialized, 0); |
| 326 | int rc; |
| 327 | do { |
| 328 | rc = ::recv(_sockfd, reinterpret_cast<char*>(buffer), length, flags); |
| 329 | } while (rc < 0 && Net::LastError() == NET_EINTR); |
| 330 | |
| 331 | if (rc < 0) { |
| 332 | int err = Net::LastError(); |
| 333 | if (err == NET_EAGAIN || err == NET_EWOULDBLOCK || (err == NET_ENOTCONN && _connecting)) |
| 334 | rc = 0; |
| 335 | else |
| 336 | Net::SetException(ex, err," (length=",length,", flags=",flags,")"); |
| 337 | } |
| 338 | if (rc >= 0) { |
| 339 | lock_guard<mutex> lock(_mutexAsync); |
| 340 | _connecting = false; |
| 341 | } |
| 342 | return rc; |
| 343 | } |
| 344 | |
| 345 | |
| 346 | int sendTo(Exception& ex, const void* buffer, int length, const SocketAddress& address, bool allowBroadcast,int flags) { |
nothing calls this directly
no outgoing calls
no test coverage detected