diff --git a/src/TcpSocket.cpp b/src/TcpSocket.cpp index 2294a98..3105c2e 100644 --- a/src/TcpSocket.cpp +++ b/src/TcpSocket.cpp @@ -31,12 +31,7 @@ namespace fr } else if(errno != EWOULDBLOCK && errno != EAGAIN) //Don't exit if the socket just couldn't block { - if(status == -1) - { - return Socket::Status::Error; - } - - is_connected = false; + close_socket(); return Socket::Status::Disconnected; } } @@ -69,12 +64,8 @@ namespace fr { return Socket::Status::WouldBlock; } - else if(status == -1) - { - return Socket::Status::Error; - } - is_connected = false; + close_socket(); return Socket::Status::Disconnected; }