diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 20:31:53 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 20:31:53 +0000 |
commit | efaba4815ff6786082583393ad06f8c22ef11fa0 (patch) | |
tree | 368934ea021799b0b37d00bd60ecfb03888ae60a /net/socket/tcp_client_socket_libevent.cc | |
parent | 638e491687f71c691ab7551795f827c86fb98765 (diff) | |
download | chromium_src-efaba4815ff6786082583393ad06f8c22ef11fa0.zip chromium_src-efaba4815ff6786082583393ad06f8c22ef11fa0.tar.gz chromium_src-efaba4815ff6786082583393ad06f8c22ef11fa0.tar.bz2 |
Make TCP FastOpen work again.
In TCPClientSocketLibevent, this requires making IsConnected pretend the
socket is connected so that GetPeerAddress will succeed.
In SSLClientSocketNSS, revert the workaround because we don't need to
delay the GetPeerAddress call.
R=mbelshe@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7155014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90090 0039d316-1c4b-4281-b951-d872f2087c98
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; |