OLD | NEW |
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/crypto/proof_verifier.h" | 8 #include "net/quic/crypto/proof_verifier.h" |
9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // To avoid deleting a stream in mid-operation, we have a simple shim between | 27 // To avoid deleting a stream in mid-operation, we have a simple shim between |
28 // us and the stream, so we can delete any streams when we return from | 28 // us and the stream, so we can delete any streams when we return from |
29 // processing. | 29 // processing. |
30 // | 30 // |
31 // We could just override the base methods, but this makes it easier to make | 31 // We could just override the base methods, but this makes it easier to make |
32 // sure we don't miss any. | 32 // sure we don't miss any. |
33 class VisitorShim : public QuicConnectionVisitorInterface { | 33 class VisitorShim : public QuicConnectionVisitorInterface { |
34 public: | 34 public: |
35 explicit VisitorShim(QuicSession* session) : session_(session) {} | 35 explicit VisitorShim(QuicSession* session) : session_(session) {} |
36 | 36 |
37 virtual void OnStreamFrames(const vector<QuicStreamFrame>& frames) override { | 37 void OnStreamFrames(const vector<QuicStreamFrame>& frames) override { |
38 session_->OnStreamFrames(frames); | 38 session_->OnStreamFrames(frames); |
39 session_->PostProcessAfterData(); | 39 session_->PostProcessAfterData(); |
40 } | 40 } |
41 virtual void OnRstStream(const QuicRstStreamFrame& frame) override { | 41 void OnRstStream(const QuicRstStreamFrame& frame) override { |
42 session_->OnRstStream(frame); | 42 session_->OnRstStream(frame); |
43 session_->PostProcessAfterData(); | 43 session_->PostProcessAfterData(); |
44 } | 44 } |
45 | 45 |
46 virtual void OnGoAway(const QuicGoAwayFrame& frame) override { | 46 void OnGoAway(const QuicGoAwayFrame& frame) override { |
47 session_->OnGoAway(frame); | 47 session_->OnGoAway(frame); |
48 session_->PostProcessAfterData(); | 48 session_->PostProcessAfterData(); |
49 } | 49 } |
50 | 50 |
51 virtual void OnWindowUpdateFrames(const vector<QuicWindowUpdateFrame>& frames) | 51 void OnWindowUpdateFrames( |
52 override { | 52 const vector<QuicWindowUpdateFrame>& frames) override { |
53 session_->OnWindowUpdateFrames(frames); | 53 session_->OnWindowUpdateFrames(frames); |
54 session_->PostProcessAfterData(); | 54 session_->PostProcessAfterData(); |
55 } | 55 } |
56 | 56 |
57 virtual void OnBlockedFrames(const vector<QuicBlockedFrame>& frames) | 57 void OnBlockedFrames(const vector<QuicBlockedFrame>& frames) override { |
58 override { | |
59 session_->OnBlockedFrames(frames); | 58 session_->OnBlockedFrames(frames); |
60 session_->PostProcessAfterData(); | 59 session_->PostProcessAfterData(); |
61 } | 60 } |
62 | 61 |
63 virtual void OnCanWrite() override { | 62 void OnCanWrite() override { |
64 session_->OnCanWrite(); | 63 session_->OnCanWrite(); |
65 session_->PostProcessAfterData(); | 64 session_->PostProcessAfterData(); |
66 } | 65 } |
67 | 66 |
68 virtual void OnCongestionWindowChange(QuicTime now) override { | 67 void OnCongestionWindowChange(QuicTime now) override { |
69 session_->OnCongestionWindowChange(now); | 68 session_->OnCongestionWindowChange(now); |
70 } | 69 } |
71 | 70 |
72 virtual void OnSuccessfulVersionNegotiation( | 71 void OnSuccessfulVersionNegotiation(const QuicVersion& version) override { |
73 const QuicVersion& version) override { | |
74 session_->OnSuccessfulVersionNegotiation(version); | 72 session_->OnSuccessfulVersionNegotiation(version); |
75 } | 73 } |
76 | 74 |
77 virtual void OnConnectionClosed( | 75 void OnConnectionClosed(QuicErrorCode error, bool from_peer) override { |
78 QuicErrorCode error, bool from_peer) override { | |
79 session_->OnConnectionClosed(error, from_peer); | 76 session_->OnConnectionClosed(error, from_peer); |
80 // The session will go away, so don't bother with cleanup. | 77 // The session will go away, so don't bother with cleanup. |
81 } | 78 } |
82 | 79 |
83 virtual void OnWriteBlocked() override { | 80 void OnWriteBlocked() override { session_->OnWriteBlocked(); } |
84 session_->OnWriteBlocked(); | |
85 } | |
86 | 81 |
87 virtual bool WillingAndAbleToWrite() const override { | 82 bool WillingAndAbleToWrite() const override { |
88 return session_->WillingAndAbleToWrite(); | 83 return session_->WillingAndAbleToWrite(); |
89 } | 84 } |
90 | 85 |
91 virtual bool HasPendingHandshake() const override { | 86 bool HasPendingHandshake() const override { |
92 return session_->HasPendingHandshake(); | 87 return session_->HasPendingHandshake(); |
93 } | 88 } |
94 | 89 |
95 virtual bool HasOpenDataStreams() const override { | 90 bool HasOpenDataStreams() const override { |
96 return session_->HasOpenDataStreams(); | 91 return session_->HasOpenDataStreams(); |
97 } | 92 } |
98 | 93 |
99 private: | 94 private: |
100 QuicSession* session_; | 95 QuicSession* session_; |
101 }; | 96 }; |
102 | 97 |
103 QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config) | 98 QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config) |
104 : connection_(connection), | 99 : connection_(connection), |
105 visitor_shim_(new VisitorShim(this)), | 100 visitor_shim_(new VisitorShim(this)), |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 for (DataStreamMap::iterator it = stream_map_.begin(); | 785 for (DataStreamMap::iterator it = stream_map_.begin(); |
791 it != stream_map_.end(); ++it) { | 786 it != stream_map_.end(); ++it) { |
792 if (it->second->flow_controller()->IsBlocked()) { | 787 if (it->second->flow_controller()->IsBlocked()) { |
793 return true; | 788 return true; |
794 } | 789 } |
795 } | 790 } |
796 return false; | 791 return false; |
797 } | 792 } |
798 | 793 |
799 } // namespace net | 794 } // namespace net |
OLD | NEW |