diff options
author | Haavard <havardpe@yahoo-inc.com> | 2017-04-04 13:40:38 +0000 |
---|---|---|
committer | Haavard <havardpe@yahoo-inc.com> | 2017-04-04 13:40:38 +0000 |
commit | 7685455fa009ac5279a5c51bf6ec164e64241ef3 (patch) | |
tree | e90d26ed0f6eb034ffb48fb61e576e60bccb36e7 /fnet | |
parent | edd8622348ed6799b47eb318117002aa88878fcd (diff) |
handle sync connect the same way as async connect
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 beb7a16abbb..afda05c7b61 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); } |