summaryrefslogtreecommitdiffstats
path: root/jingle
diff options
context:
space:
mode:
Diffstat (limited to 'jingle')
-rw-r--r--jingle/notifier/base/fake_ssl_client_socket.cc4
-rw-r--r--jingle/notifier/base/fake_ssl_client_socket.h1
-rw-r--r--jingle/notifier/base/fake_ssl_client_socket_unittest.cc2
-rw-r--r--jingle/notifier/communicator/ssl_socket_adapter.cc15
-rw-r--r--jingle/notifier/communicator/ssl_socket_adapter.h3
5 files changed, 23 insertions, 2 deletions
diff --git a/jingle/notifier/base/fake_ssl_client_socket.cc b/jingle/notifier/base/fake_ssl_client_socket.cc
index a89a594..cd5d5f5 100644
--- a/jingle/notifier/base/fake_ssl_client_socket.cc
+++ b/jingle/notifier/base/fake_ssl_client_socket.cc
@@ -324,4 +324,8 @@ void FakeSSLClientSocket::SetOmniboxSpeculation() {
transport_socket_->SetOmniboxSpeculation();
}
+bool FakeSSLClientSocket::WasEverUsed() const {
+ return transport_socket_->WasEverUsed();
+}
+
} // namespace notifier
diff --git a/jingle/notifier/base/fake_ssl_client_socket.h b/jingle/notifier/base/fake_ssl_client_socket.h
index bcf09f8..d70d4d3 100644
--- a/jingle/notifier/base/fake_ssl_client_socket.h
+++ b/jingle/notifier/base/fake_ssl_client_socket.h
@@ -59,6 +59,7 @@ class FakeSSLClientSocket : public net::ClientSocket {
virtual const net::BoundNetLog& NetLog() const;
virtual void SetSubresourceSpeculation();
virtual void SetOmniboxSpeculation();
+ virtual bool WasEverUsed() const;
private:
enum HandshakeState {
diff --git a/jingle/notifier/base/fake_ssl_client_socket_unittest.cc b/jingle/notifier/base/fake_ssl_client_socket_unittest.cc
index 2ca3adf..3b7aa50 100644
--- a/jingle/notifier/base/fake_ssl_client_socket_unittest.cc
+++ b/jingle/notifier/base/fake_ssl_client_socket_unittest.cc
@@ -59,6 +59,7 @@ class MockClientSocket : public net::ClientSocket {
MOCK_CONST_METHOD0(NetLog, const net::BoundNetLog&());
MOCK_METHOD0(SetSubresourceSpeculation, void());
MOCK_METHOD0(SetOmniboxSpeculation, void());
+ MOCK_CONST_METHOD0(WasEverUsed, bool());
};
// Break up |data| into a bunch of chunked MockReads/Writes and push
@@ -336,4 +337,3 @@ TEST_F(FakeSSLClientSocketTest, MalformedServerHello) {
} // namespace
} // namespace notifier
-
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);
};