| 684 | #endif |
| 685 | |
| 686 | bool CloseSocket(SOCKET& hSocket) |
| 687 | { |
| 688 | if (hSocket == INVALID_SOCKET) |
| 689 | return false; |
| 690 | #ifdef WIN32 |
| 691 | int ret = closesocket(hSocket); |
| 692 | #else |
| 693 | int ret = close(hSocket); |
| 694 | #endif |
| 695 | if (ret) { |
| 696 | LogPrintf("Socket close failed: %d. Error: %s\n", hSocket, NetworkErrorString(WSAGetLastError())); |
| 697 | } |
| 698 | hSocket = INVALID_SOCKET; |
| 699 | return ret != SOCKET_ERROR; |
| 700 | } |
| 701 | |
| 702 | bool SetSocketNonBlocking(const SOCKET& hSocket, bool fNonBlocking) |
| 703 | { |
no test coverage detected