diff options
Diffstat (limited to 'net/socket/tcp_client_socket_libevent.cc')
-rw-r--r-- | net/socket/tcp_client_socket_libevent.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index 8540342..38c3446 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -384,6 +384,15 @@ bool TCPClientSocketLibevent::IsConnected() const { if (socket_ == kInvalidSocket || waiting_connect()) return false; + if (use_tcp_fastopen_ && !tcp_fastopen_connected_) { + // With TCP FastOpen, we pretend that the socket is connected. + // This allows GetPeerAddress() to return current_ai_ as the peer + // address. Since we don't fail over to the next address if + // sendto() fails, current_ai_ is the only possible peer address. + CHECK(current_ai_); + return true; + } + // Check if connection is alive. char c; int rv = HANDLE_EINTR(recv(socket_, &c, 1, MSG_PEEK)); @@ -401,6 +410,9 @@ bool TCPClientSocketLibevent::IsConnectedAndIdle() const { if (socket_ == kInvalidSocket || waiting_connect()) return false; + // TODO(wtc): should we also handle the TCP FastOpen case here, + // as we do in IsConnected()? + // Check if connection is alive and we haven't received any data // unexpectedly. char c; |