summaryrefslogtreecommitdiffstats
path: root/net/socket/tcp_client_socket_libevent.cc
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-23 10:50:46 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-23 10:50:46 +0000
commit598c903bce41b7889306125600b18145e21b69a1 (patch)
tree37dae423699e0c0591b548cb944211152cfe5ec6 /net/socket/tcp_client_socket_libevent.cc
parentf08debf793cbef2aaab349ae4928d142986ea7c2 (diff)
downloadchromium_src-598c903bce41b7889306125600b18145e21b69a1.zip
chromium_src-598c903bce41b7889306125600b18145e21b69a1.tar.gz
chromium_src-598c903bce41b7889306125600b18145e21b69a1.tar.bz2
Add Reset to ClientSocket::UseHistory, and call on TCP disconnect.
The HttpProxyClientSocket reuses the same TcpClientSocket in the case that it is trying to establish a tunnel through an authenticating proxy, but the proxy closed the TCP connection. Also, fix SetOmniboxSpeculation on the TCPClientSocket implementations. BUG=54062 TEST=Tried normal connections to make sure histograms were only emitted once, as well as https tunnels through an authenticating proxy to ensure that the use_history was correctly reset. Review URL: http://codereview.chromium.org/3360007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63643 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_libevent.cc')
-rw-r--r--net/socket/tcp_client_socket_libevent.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index aedbf8a..cda0955 100644
--- a/net/socket/tcp_client_socket_libevent.cc
+++ b/net/socket/tcp_client_socket_libevent.cc
@@ -120,7 +120,8 @@ TCPClientSocketLibevent::TCPClientSocketLibevent(
write_callback_(NULL),
next_connect_state_(CONNECT_STATE_NONE),
connect_os_error_(0),
- net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)) {
+ net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)),
+ previously_disconnected_(false) {
scoped_refptr<NetLog::EventParameters> params;
if (source.is_valid())
params = new NetLogSourceParameter("source_dependency", source);
@@ -194,6 +195,11 @@ int TCPClientSocketLibevent::DoConnect() {
DCHECK_EQ(0, connect_os_error_);
+ if (previously_disconnected_) {
+ use_history_.Reset();
+ previously_disconnected_ = false;
+ }
+
net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT_ATTEMPT,
new NetLogStringParameter(
"address", NetAddressToStringWithPort(current_ai_)));
@@ -278,6 +284,7 @@ void TCPClientSocketLibevent::DoDisconnect() {
if (HANDLE_EINTR(close(socket_)) < 0)
PLOG(ERROR) << "close";
socket_ = kInvalidSocket;
+ previously_disconnected_ = true;
}
bool TCPClientSocketLibevent::IsConnected() const {