Index: net/quic/quic_session.cc |
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc |
index c57dc1ed35f047153eb6880726c21ae2d8dea703..6d5496eeafd66803e7c60dcf090ccc20555a6d15 100644 |
--- a/net/quic/quic_session.cc |
+++ b/net/quic/quic_session.cc |
@@ -30,82 +30,8 @@ namespace net { |
#define ENDPOINT \ |
(perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ") |
-// We want to make sure we delete any closed streams in a safe manner. |
-// To avoid deleting a stream in mid-operation, we have a simple shim between |
-// us and the stream, so we can delete any streams when we return from |
-// processing. |
-// |
-// We could just override the base methods, but this makes it easier to make |
-// sure we don't miss any. |
-class VisitorShim : public QuicConnectionVisitorInterface { |
- public: |
- explicit VisitorShim(QuicSession* session) : session_(session) {} |
- |
- void OnStreamFrame(const QuicStreamFrame& frame) override { |
- session_->OnStreamFrame(frame); |
- session_->PostProcessAfterData(); |
- } |
- void OnRstStream(const QuicRstStreamFrame& frame) override { |
- session_->OnRstStream(frame); |
- session_->PostProcessAfterData(); |
- } |
- |
- void OnGoAway(const QuicGoAwayFrame& frame) override { |
- session_->OnGoAway(frame); |
- session_->PostProcessAfterData(); |
- } |
- |
- void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) override { |
- session_->OnWindowUpdateFrame(frame); |
- session_->PostProcessAfterData(); |
- } |
- |
- void OnBlockedFrame(const QuicBlockedFrame& frame) override { |
- session_->OnBlockedFrame(frame); |
- session_->PostProcessAfterData(); |
- } |
- |
- void OnCanWrite() override { |
- session_->OnCanWrite(); |
- session_->PostProcessAfterData(); |
- } |
- |
- void OnCongestionWindowChange(QuicTime now) override { |
- session_->OnCongestionWindowChange(now); |
- } |
- |
- void OnSuccessfulVersionNegotiation(const QuicVersion& version) override { |
- session_->OnSuccessfulVersionNegotiation(version); |
- } |
- |
- void OnConnectionClosed(QuicErrorCode error, bool from_peer) override { |
- session_->OnConnectionClosed(error, from_peer); |
- // The session will go away, so don't bother with cleanup. |
- } |
- |
- void OnWriteBlocked() override { session_->OnWriteBlocked(); } |
- |
- void OnConnectionMigration() override { session_->OnConnectionMigration(); } |
- |
- bool WillingAndAbleToWrite() const override { |
- return session_->WillingAndAbleToWrite(); |
- } |
- |
- bool HasPendingHandshake() const override { |
- return session_->HasPendingHandshake(); |
- } |
- |
- bool HasOpenDynamicStreams() const override { |
- return session_->HasOpenDynamicStreams(); |
- } |
- |
- private: |
- QuicSession* session_; |
-}; |
- |
QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config) |
: connection_(connection), |
- visitor_shim_(new VisitorShim(this)), |
config_(config), |
max_open_streams_(config_.MaxStreamsPerConnection()), |
next_outgoing_stream_id_(perspective() == Perspective::IS_SERVER ? 2 : 3), |
@@ -124,7 +50,7 @@ QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config) |
currently_writing_stream_id_(0) {} |
void QuicSession::Initialize() { |
- connection_->set_visitor(visitor_shim_.get()); |
+ connection_->set_visitor(this); |
connection_->SetFromConfig(config_); |
DCHECK_EQ(kCryptoStreamId, GetCryptoStream()->id()); |