Commit ed42a1e7 authored by wtc@chromium.org's avatar wtc@chromium.org

Reimplement QuicCryptoClientStream::WasChannelIDSent with a boolean

member so we can free channel_id_key_ after we're finished with it.

This fixes a TODO in https://codereview.chromium.org/355293003/.

R=rch@chromium.org
BUG=none

Review URL: https://codereview.chromium.org/397803004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283569 0039d316-1c4b-4281-b951-d872f2087c98
parent 5096f7f6
......@@ -66,20 +66,6 @@ class TestPacketWriter : public QuicDefaultPacketWriter {
QuicPacketHeader header_;
};
class FakeChannelIDKey : public ChannelIDKey {
public:
// ChannelIDKey implementation
virtual bool Sign(base::StringPiece signed_data,
std::string* out_signature) const OVERRIDE {
*out_signature = "";
return true;
}
virtual std::string SerializeKey() const OVERRIDE {
return "";
}
};
class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> {
protected:
QuicClientSessionTest()
......@@ -223,7 +209,7 @@ TEST_P(QuicClientSessionTest, ConnectionPooledWithTlsChannelId) {
session_.OnProofVerifyDetailsAvailable(details);
CompleteCryptoHandshake();
QuicClientSessionPeer::SetChannelIDKey(&session_, new FakeChannelIDKey);
QuicClientSessionPeer::SetChannelIDSent(&session_, true);
EXPECT_TRUE(session_.CanPool("www.example.org"));
EXPECT_TRUE(session_.CanPool("mail.example.org"));
......
......@@ -78,6 +78,7 @@ QuicCryptoClientStream::QuicCryptoClientStream(
crypto_config_(crypto_config),
server_id_(server_id),
generation_counter_(0),
channel_id_sent_(false),
channel_id_source_callback_(NULL),
verify_context_(verify_context),
proof_verify_callback_(NULL) {
......@@ -110,9 +111,7 @@ int QuicCryptoClientStream::num_sent_client_hellos() const {
}
bool QuicCryptoClientStream::WasChannelIDSent() const {
// TODO(rch): we should replace this with a boolean member so we
// can free the memory associated with the key after we're finished with it.
return channel_id_key_.get() != NULL;
return channel_id_sent_;
}
// kMaxClientHellos is the maximum number of times that we'll send a client
......@@ -203,6 +202,7 @@ void QuicCryptoClientStream::DoHandshakeLoop(
CloseConnectionWithDetails(error, error_details);
return;
}
channel_id_sent_ = (channel_id_key_.get() != NULL);
if (cached->proof_verify_details()) {
client_session()->OnProofVerifyDetailsAvailable(
*cached->proof_verify_details());
......
......@@ -133,6 +133,9 @@ class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream {
// Generation counter from QuicCryptoClientConfig's CachedState.
uint64 generation_counter_;
// True if a channel ID was sent.
bool channel_id_sent_;
// channel_id_source_callback_ contains the callback object that we passed
// to an asynchronous channel ID lookup. The ChannelIDSource owns this
// object.
......
......@@ -18,9 +18,9 @@ void QuicClientSessionPeer::SetMaxOpenStreams(QuicClientSession* session,
}
// static
void QuicClientSessionPeer::SetChannelIDKey(QuicClientSession* session,
ChannelIDKey* channel_id_key) {
session->crypto_stream_->channel_id_key_.reset(channel_id_key);
void QuicClientSessionPeer::SetChannelIDSent(QuicClientSession* session,
bool channel_id_sent) {
session->crypto_stream_->channel_id_sent_ = channel_id_sent;
}
} // namespace test
......
......@@ -9,7 +9,6 @@
namespace net {
class ChannelIDKey;
class QuicClientSession;
namespace test {
......@@ -20,8 +19,8 @@ class QuicClientSessionPeer {
size_t max_streams,
size_t default_streams);
static void SetChannelIDKey(QuicClientSession* session,
ChannelIDKey* channel_id_key);
static void SetChannelIDSent(QuicClientSession* session,
bool channel_id_sent);
private:
DISALLOW_COPY_AND_ASSIGN(QuicClientSessionPeer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment