diff options
Diffstat (limited to 'fnet')
-rw-r--r-- | fnet/src/vespa/fnet/connection.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/fnet/src/vespa/fnet/connection.cpp b/fnet/src/vespa/fnet/connection.cpp index 82f757a6027..cc2e846741b 100644 --- a/fnet/src/vespa/fnet/connection.cpp +++ b/fnet/src/vespa/fnet/connection.cpp @@ -487,17 +487,13 @@ FNET_Connection::Init() if (GetConfig()->_tcpNoDelay) _socket->SetNoDelay(true); EnableReadEvent(true); - if (IsClient()) { - if (_socket->Connect()) { - SetState(FNET_CONNECTED); - } else { + EnableWriteEvent(true); + if (!_socket->Connect()) { int error = FastOS_Socket::GetLastError(); - - if (error == FastOS_Socket::ERR_INPROGRESS || - error == FastOS_Socket::ERR_WOULDBLOCK) { - EnableWriteEvent(true); - } else { + if (error != FastOS_Socket::ERR_INPROGRESS && + error != FastOS_Socket::ERR_WOULDBLOCK) + { rc = false; LOG(debug, "Connection(%s): connect error: %d", GetSpec(), error); } |