summaryrefslogtreecommitdiffstats
path: root/jingle/notifier/communicator
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 16:09:01 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 16:09:01 +0000
commit0f873e8291deea212112dc7d6b48b0f0450522c2 (patch)
treed888b57c8ff0e55d322e450d9df2d1f5eb36d283 /jingle/notifier/communicator
parenteb7ce94497639ec1e9a7a1549dc941d8e28e98ba (diff)
downloadchromium_src-0f873e8291deea212112dc7d6b48b0f0450522c2.zip
chromium_src-0f873e8291deea212112dc7d6b48b0f0450522c2.tar.gz
chromium_src-0f873e8291deea212112dc7d6b48b0f0450522c2.tar.bz2
Fix ClientSocketHandle reuse_type(). Correctly track socket use.
In particular, we used to consider that a socket had been used whenever it got returned to the ClientSocketPool. But, with preconnect, that is no longer true. Luckily, we now have UseHistory in the transport sockets. So, I create a WasEverUsed() method in ClientSocket, plumb this into all sockets, and use that in ClientSocketPoolBaseHelper instead of tracking whether or not the socket had been returned to the client or not. This ultimately will have two implications. We will record the correct values in Net.HttpSocketType histograms and we will use the correct timeout for preconnect sockets in ClientSocketPoolBaseHelper::CleanupIdleSockets(). BUG=none TEST=none Review URL: http://codereview.chromium.org/3353004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58363 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/notifier/communicator')
-rw-r--r--jingle/notifier/communicator/ssl_socket_adapter.cc15
-rw-r--r--jingle/notifier/communicator/ssl_socket_adapter.h3
2 files changed, 17 insertions, 1 deletions
diff --git a/jingle/notifier/communicator/ssl_socket_adapter.cc b/jingle/notifier/communicator/ssl_socket_adapter.cc
index 30d28fe..cac3041 100644
--- a/jingle/notifier/communicator/ssl_socket_adapter.cc
+++ b/jingle/notifier/communicator/ssl_socket_adapter.cc
@@ -220,7 +220,8 @@ TransportSocket::TransportSocket(talk_base::AsyncSocket* socket,
write_callback_(NULL),
read_buffer_len_(0),
write_buffer_len_(0),
- socket_(socket) {
+ socket_(socket),
+ was_used_to_convey_data_(false) {
socket_->SignalReadEvent.connect(this, &TransportSocket::OnReadEvent);
socket_->SignalWriteEvent.connect(this, &TransportSocket::OnWriteEvent);
}
@@ -276,6 +277,12 @@ void TransportSocket::SetOmniboxSpeculation() {
NOTREACHED();
}
+bool TransportSocket::WasEverUsed() const {
+ // We don't use this in ClientSocketPools, so this should never be used.
+ NOTREACHED();
+ return was_used_to_convey_data_;
+}
+
int TransportSocket::Read(net::IOBuffer* buf, int buf_len,
net::CompletionCallback* callback) {
DCHECK(buf);
@@ -290,6 +297,8 @@ int TransportSocket::Read(net::IOBuffer* buf, int buf_len,
read_buffer_len_ = buf_len;
}
}
+ if (result != net::ERR_IO_PENDING)
+ was_used_to_convey_data_ = true;
return result;
}
@@ -307,6 +316,8 @@ int TransportSocket::Write(net::IOBuffer* buf, int buf_len,
write_buffer_len_ = buf_len;
}
}
+ if (result != net::ERR_IO_PENDING)
+ was_used_to_convey_data_ = true;
return result;
}
@@ -341,6 +352,7 @@ void TransportSocket::OnReadEvent(talk_base::AsyncSocket* socket) {
return;
}
}
+ was_used_to_convey_data_ = true;
callback->RunWithParams(Tuple1<int>(result));
}
}
@@ -366,6 +378,7 @@ void TransportSocket::OnWriteEvent(talk_base::AsyncSocket* socket) {
return;
}
}
+ was_used_to_convey_data_ = true;
callback->RunWithParams(Tuple1<int>(result));
}
}
diff --git a/jingle/notifier/communicator/ssl_socket_adapter.h b/jingle/notifier/communicator/ssl_socket_adapter.h
index 42b20a8..cdbc94e 100644
--- a/jingle/notifier/communicator/ssl_socket_adapter.h
+++ b/jingle/notifier/communicator/ssl_socket_adapter.h
@@ -45,6 +45,7 @@ class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> {
virtual const net::BoundNetLog& NetLog() const { return net_log_; }
virtual void SetSubresourceSpeculation();
virtual void SetOmniboxSpeculation();
+ virtual bool WasEverUsed() const;
// net::Socket implementation
@@ -74,6 +75,8 @@ class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> {
talk_base::AsyncSocket *socket_;
talk_base::SocketAddress addr_;
+ bool was_used_to_convey_data_;
+
DISALLOW_COPY_AND_ASSIGN(TransportSocket);
};