diff options
author | HÃ¥vard Pettersen <havardpe@gmail.com> | 2017-04-05 11:38:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-05 11:38:38 +0200 |
commit | d3a34a72126fcb22c8474986d196edff94646f4c (patch) | |
tree | f55dc3c7a2f250e79d66725e70d5817b81fe5c57 /fnet | |
parent | 868e56d952c2dd4e24e48456ef942d6c240cd353 (diff) | |
parent | 7685455fa009ac5279a5c51bf6ec164e64241ef3 (diff) |
Merge pull request #2151 from yahoo/havardpe/handle-sync-connect-as-async-connect
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 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); } |