Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: net/quic/quic_session.cc

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/quic_connection.h" 8 #include "net/quic/quic_connection.h"
9 9
10 using base::StringPiece; 10 using base::StringPiece;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE { 58 virtual void ConnectionClose(QuicErrorCode error, bool from_peer) OVERRIDE {
59 session_->ConnectionClose(error, from_peer); 59 session_->ConnectionClose(error, from_peer);
60 // The session will go away, so don't bother with cleanup. 60 // The session will go away, so don't bother with cleanup.
61 } 61 }
62 62
63 private: 63 private:
64 QuicSession* session_; 64 QuicSession* session_;
65 }; 65 };
66 66
67 QuicSession::QuicSession(QuicConnection* connection, bool is_server) 67 QuicSession::QuicSession(QuicConnection* connection,
68 const QuicConfig& config,
69 bool is_server)
68 : connection_(connection), 70 : connection_(connection),
69 visitor_shim_(new VisitorShim(this)), 71 visitor_shim_(new VisitorShim(this)),
72 config_(config),
70 max_open_streams_(kDefaultMaxStreamsPerConnection), 73 max_open_streams_(kDefaultMaxStreamsPerConnection),
71 next_stream_id_(is_server ? 2 : 3), 74 next_stream_id_(is_server ? 2 : 3),
72 is_server_(is_server), 75 is_server_(is_server),
73 largest_peer_created_stream_id_(0), 76 largest_peer_created_stream_id_(0),
74 goaway_received_(false), 77 goaway_received_(false),
75 goaway_sent_(false) { 78 goaway_sent_(false) {
76 connection->set_visitor(visitor_shim_.get()); 79 connection->set_visitor(visitor_shim_.get());
77 } 80 }
78 81
79 QuicSession::~QuicSession() { 82 QuicSession::~QuicSession() {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 bool QuicSession::IsEncryptionEstablished() { 210 bool QuicSession::IsEncryptionEstablished() {
208 return GetCryptoStream()->encryption_established(); 211 return GetCryptoStream()->encryption_established();
209 } 212 }
210 213
211 bool QuicSession::IsCryptoHandshakeConfirmed() { 214 bool QuicSession::IsCryptoHandshakeConfirmed() {
212 return GetCryptoStream()->handshake_confirmed(); 215 return GetCryptoStream()->handshake_confirmed();
213 } 216 }
214 217
215 void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { 218 void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) {
216 if (event == QuicSession::HANDSHAKE_CONFIRMED) { 219 if (event == QuicSession::HANDSHAKE_CONFIRMED) {
217 connection_->SetConnectionTimeout( 220 LOG_IF(DFATAL, !config_.negotiated())
218 GetCryptoStream()->negotiated_params().idle_connection_state_lifetime); 221 << "Handshake confirmed without parameter negotiation.";
222 connection_->SetConnectionTimeout(config_.idle_connection_state_lifetime());
223 max_open_streams_ = config_.max_streams_per_connection();
219 } 224 }
220 } 225 }
221 226
227 QuicConfig* QuicSession::config() {
228 return &config_;
229 }
230
222 void QuicSession::ActivateStream(ReliableQuicStream* stream) { 231 void QuicSession::ActivateStream(ReliableQuicStream* stream) {
223 DLOG(INFO) << "num_streams: " << stream_map_.size() 232 DLOG(INFO) << "num_streams: " << stream_map_.size()
224 << ". activating " << stream->id(); 233 << ". activating " << stream->id();
225 DCHECK(stream_map_.count(stream->id()) == 0); 234 DCHECK(stream_map_.count(stream->id()) == 0);
226 stream_map_[stream->id()] = stream; 235 stream_map_[stream->id()] = stream;
227 } 236 }
228 237
229 QuicStreamId QuicSession::GetNextStreamId() { 238 QuicStreamId QuicSession::GetNextStreamId() {
230 QuicStreamId id = next_stream_id_; 239 QuicStreamId id = next_stream_id_;
231 next_stream_id_ += 2; 240 next_stream_id_ += 2;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 QuicStreamId stream_id) { 333 QuicStreamId stream_id) {
325 decompression_blocked_streams_[header_id] = stream_id; 334 decompression_blocked_streams_[header_id] = stream_id;
326 } 335 }
327 336
328 void QuicSession::PostProcessAfterData() { 337 void QuicSession::PostProcessAfterData() {
329 STLDeleteElements(&closed_streams_); 338 STLDeleteElements(&closed_streams_);
330 closed_streams_.clear(); 339 closed_streams_.clear();
331 } 340 }
332 341
333 } // namespace net 342 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698