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

Unified Diff: net/quic/quic_session.cc

Issue 12334063: Land recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more EXPECT_FALSE Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_session.cc
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc
index ef0efbe330e1932f5f1b0e9a32044f7fb94e8a19..dfcea32d8c9ff9e84d709596ac3052154e82b9fe 100644
--- a/net/quic/quic_session.cc
+++ b/net/quic/quic_session.cc
@@ -39,7 +39,12 @@ class VisitorShim : public QuicConnectionVisitorInterface {
session_->PostProcessAfterData();
}
- virtual void OnAck(AckedPackets acked_packets) OVERRIDE {
+ virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE {
+ session_->OnGoAway(frame);
+ session_->PostProcessAfterData();
+ }
+
+ virtual void OnAck(const SequenceNumberSet& acked_packets) OVERRIDE {
session_->OnAck(acked_packets);
session_->PostProcessAfterData();
}
@@ -65,7 +70,9 @@ QuicSession::QuicSession(QuicConnection* connection, bool is_server)
max_open_streams_(kDefaultMaxStreamsPerConnection),
next_stream_id_(is_server ? 2 : 3),
is_server_(is_server),
- largest_peer_created_stream_id_(0) {
+ largest_peer_created_stream_id_(0),
+ goaway_received_(false),
+ goaway_sent_(false) {
connection->set_visitor(visitor_shim_.get());
}
@@ -109,7 +116,12 @@ void QuicSession::OnRstStream(const QuicRstStreamFrame& frame) {
if (!stream) {
return; // Errors are handled by GetStream.
}
- stream->OnStreamReset(frame.error_code, frame.offset);
+ stream->OnStreamReset(frame.error_code);
+}
+
+void QuicSession::OnGoAway(const QuicGoAwayFrame& frame) {
+ DCHECK(frame.last_good_stream_id < next_stream_id_);
+ goaway_received_ = true;
}
void QuicSession::ConnectionClose(QuicErrorCode error, bool from_peer) {
@@ -150,18 +162,20 @@ QuicConsumedData QuicSession::WriteData(QuicStreamId id,
StringPiece data,
QuicStreamOffset offset,
bool fin) {
- // TODO(wtc): type mismatch -- connection_->SendStreamData() returns a
- // size_t.
return connection_->SendStreamData(id, data, offset, fin);
}
void QuicSession::SendRstStream(QuicStreamId id,
- QuicErrorCode error,
- QuicStreamOffset offset) {
- connection_->SendRstStream(id, error, offset);
+ QuicErrorCode error) {
+ connection_->SendRstStream(id, error);
CloseStream(id);
}
+void QuicSession::SendGoAway(QuicErrorCode error_code, const string& reason) {
+ goaway_sent_ = true;
+ connection_->SendGoAway(error_code, largest_peer_created_stream_id_, reason);
+}
+
void QuicSession::CloseStream(QuicStreamId stream_id) {
DLOG(INFO) << "Closing stream " << stream_id;
@@ -226,6 +240,12 @@ ReliableQuicStream* QuicSession::GetIncomingReliableStream(
return NULL;
}
+ if (goaway_sent_) {
+ // We've already sent a GoAway
+ connection()->SendRstStream(stream_id, QUIC_PEER_GOING_AWAY);
+ return NULL;
+ }
+
implicitly_created_streams_.erase(stream_id);
if (stream_id > largest_peer_created_stream_id_) {
// TODO(rch) add unit test for this
« 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