OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_dispatcher.h" | 5 #include "net/quic/quic_dispatcher.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 using base::StringPiece; | 21 using base::StringPiece; |
22 using std::make_pair; | 22 using std::make_pair; |
23 using std::find; | 23 using std::find; |
24 | 24 |
25 class DeleteSessionsAlarm : public QuicAlarm::Delegate { | 25 class DeleteSessionsAlarm : public QuicAlarm::Delegate { |
26 public: | 26 public: |
27 explicit DeleteSessionsAlarm(QuicDispatcher* dispatcher) | 27 explicit DeleteSessionsAlarm(QuicDispatcher* dispatcher) |
28 : dispatcher_(dispatcher) { | 28 : dispatcher_(dispatcher) { |
29 } | 29 } |
30 | 30 |
31 virtual QuicTime OnAlarm() OVERRIDE { | 31 virtual QuicTime OnAlarm() override { |
32 dispatcher_->DeleteSessions(); | 32 dispatcher_->DeleteSessions(); |
33 return QuicTime::Zero(); | 33 return QuicTime::Zero(); |
34 } | 34 } |
35 | 35 |
36 private: | 36 private: |
37 QuicDispatcher* dispatcher_; | 37 QuicDispatcher* dispatcher_; |
38 }; | 38 }; |
39 | 39 |
40 class QuicDispatcher::QuicFramerVisitor : public QuicFramerVisitorInterface { | 40 class QuicDispatcher::QuicFramerVisitor : public QuicFramerVisitorInterface { |
41 public: | 41 public: |
42 explicit QuicFramerVisitor(QuicDispatcher* dispatcher) | 42 explicit QuicFramerVisitor(QuicDispatcher* dispatcher) |
43 : dispatcher_(dispatcher), | 43 : dispatcher_(dispatcher), |
44 connection_id_(0) {} | 44 connection_id_(0) {} |
45 | 45 |
46 // QuicFramerVisitorInterface implementation | 46 // QuicFramerVisitorInterface implementation |
47 virtual void OnPacket() OVERRIDE {} | 47 virtual void OnPacket() override {} |
48 virtual bool OnUnauthenticatedPublicHeader( | 48 virtual bool OnUnauthenticatedPublicHeader( |
49 const QuicPacketPublicHeader& header) OVERRIDE { | 49 const QuicPacketPublicHeader& header) override { |
50 connection_id_ = header.connection_id; | 50 connection_id_ = header.connection_id; |
51 return dispatcher_->OnUnauthenticatedPublicHeader(header); | 51 return dispatcher_->OnUnauthenticatedPublicHeader(header); |
52 } | 52 } |
53 virtual bool OnUnauthenticatedHeader( | 53 virtual bool OnUnauthenticatedHeader( |
54 const QuicPacketHeader& header) OVERRIDE { | 54 const QuicPacketHeader& header) override { |
55 dispatcher_->OnUnauthenticatedHeader(header); | 55 dispatcher_->OnUnauthenticatedHeader(header); |
56 return false; | 56 return false; |
57 } | 57 } |
58 virtual void OnError(QuicFramer* framer) OVERRIDE { | 58 virtual void OnError(QuicFramer* framer) override { |
59 DVLOG(1) << QuicUtils::ErrorToString(framer->error()); | 59 DVLOG(1) << QuicUtils::ErrorToString(framer->error()); |
60 } | 60 } |
61 | 61 |
62 virtual bool OnProtocolVersionMismatch( | 62 virtual bool OnProtocolVersionMismatch( |
63 QuicVersion /*received_version*/) OVERRIDE { | 63 QuicVersion /*received_version*/) override { |
64 if (dispatcher_->time_wait_list_manager()->IsConnectionIdInTimeWait( | 64 if (dispatcher_->time_wait_list_manager()->IsConnectionIdInTimeWait( |
65 connection_id_)) { | 65 connection_id_)) { |
66 // Keep processing after protocol mismatch - this will be dealt with by | 66 // Keep processing after protocol mismatch - this will be dealt with by |
67 // the TimeWaitListManager. | 67 // the TimeWaitListManager. |
68 return true; | 68 return true; |
69 } else { | 69 } else { |
70 DLOG(DFATAL) << "Version mismatch, connection ID (" << connection_id_ | 70 DLOG(DFATAL) << "Version mismatch, connection ID (" << connection_id_ |
71 << ") not in time wait list."; | 71 << ") not in time wait list."; |
72 return false; | 72 return false; |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 // The following methods should never get called because we always return | 76 // The following methods should never get called because we always return |
77 // false from OnUnauthenticatedHeader(). As a result, we never process the | 77 // false from OnUnauthenticatedHeader(). As a result, we never process the |
78 // payload of the packet. | 78 // payload of the packet. |
79 virtual void OnPublicResetPacket( | 79 virtual void OnPublicResetPacket( |
80 const QuicPublicResetPacket& /*packet*/) OVERRIDE { | 80 const QuicPublicResetPacket& /*packet*/) override { |
81 DCHECK(false); | 81 DCHECK(false); |
82 } | 82 } |
83 virtual void OnVersionNegotiationPacket( | 83 virtual void OnVersionNegotiationPacket( |
84 const QuicVersionNegotiationPacket& /*packet*/) OVERRIDE { | 84 const QuicVersionNegotiationPacket& /*packet*/) override { |
85 DCHECK(false); | 85 DCHECK(false); |
86 } | 86 } |
87 virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE { | 87 virtual void OnDecryptedPacket(EncryptionLevel level) override { |
88 DCHECK(false); | 88 DCHECK(false); |
89 } | 89 } |
90 virtual bool OnPacketHeader(const QuicPacketHeader& /*header*/) OVERRIDE { | 90 virtual bool OnPacketHeader(const QuicPacketHeader& /*header*/) override { |
91 DCHECK(false); | 91 DCHECK(false); |
92 return false; | 92 return false; |
93 } | 93 } |
94 virtual void OnRevivedPacket() OVERRIDE { | 94 virtual void OnRevivedPacket() override { |
95 DCHECK(false); | 95 DCHECK(false); |
96 } | 96 } |
97 virtual void OnFecProtectedPayload(StringPiece /*payload*/) OVERRIDE { | 97 virtual void OnFecProtectedPayload(StringPiece /*payload*/) override { |
98 DCHECK(false); | 98 DCHECK(false); |
99 } | 99 } |
100 virtual bool OnStreamFrame(const QuicStreamFrame& /*frame*/) OVERRIDE { | 100 virtual bool OnStreamFrame(const QuicStreamFrame& /*frame*/) override { |
101 DCHECK(false); | 101 DCHECK(false); |
102 return false; | 102 return false; |
103 } | 103 } |
104 virtual bool OnAckFrame(const QuicAckFrame& /*frame*/) OVERRIDE { | 104 virtual bool OnAckFrame(const QuicAckFrame& /*frame*/) override { |
105 DCHECK(false); | 105 DCHECK(false); |
106 return false; | 106 return false; |
107 } | 107 } |
108 virtual bool OnCongestionFeedbackFrame( | 108 virtual bool OnCongestionFeedbackFrame( |
109 const QuicCongestionFeedbackFrame& /*frame*/) OVERRIDE { | 109 const QuicCongestionFeedbackFrame& /*frame*/) override { |
110 DCHECK(false); | 110 DCHECK(false); |
111 return false; | 111 return false; |
112 } | 112 } |
113 virtual bool OnStopWaitingFrame( | 113 virtual bool OnStopWaitingFrame( |
114 const QuicStopWaitingFrame& /*frame*/) OVERRIDE { | 114 const QuicStopWaitingFrame& /*frame*/) override { |
115 DCHECK(false); | 115 DCHECK(false); |
116 return false; | 116 return false; |
117 } | 117 } |
118 virtual bool OnPingFrame(const QuicPingFrame& /*frame*/) OVERRIDE { | 118 virtual bool OnPingFrame(const QuicPingFrame& /*frame*/) override { |
119 DCHECK(false); | 119 DCHECK(false); |
120 return false; | 120 return false; |
121 } | 121 } |
122 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) OVERRIDE { | 122 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) override { |
123 DCHECK(false); | 123 DCHECK(false); |
124 return false; | 124 return false; |
125 } | 125 } |
126 virtual bool OnConnectionCloseFrame( | 126 virtual bool OnConnectionCloseFrame( |
127 const QuicConnectionCloseFrame & /*frame*/) OVERRIDE { | 127 const QuicConnectionCloseFrame & /*frame*/) override { |
128 DCHECK(false); | 128 DCHECK(false); |
129 return false; | 129 return false; |
130 } | 130 } |
131 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) OVERRIDE { | 131 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) override { |
132 DCHECK(false); | 132 DCHECK(false); |
133 return false; | 133 return false; |
134 } | 134 } |
135 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& /*frame*/) | 135 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& /*frame*/) |
136 OVERRIDE { | 136 override { |
137 DCHECK(false); | 137 DCHECK(false); |
138 return false; | 138 return false; |
139 } | 139 } |
140 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE { | 140 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override { |
141 DCHECK(false); | 141 DCHECK(false); |
142 return false; | 142 return false; |
143 } | 143 } |
144 virtual void OnFecData(const QuicFecData& /*fec*/) OVERRIDE { | 144 virtual void OnFecData(const QuicFecData& /*fec*/) override { |
145 DCHECK(false); | 145 DCHECK(false); |
146 } | 146 } |
147 virtual void OnPacketComplete() OVERRIDE { | 147 virtual void OnPacketComplete() override { |
148 DCHECK(false); | 148 DCHECK(false); |
149 } | 149 } |
150 | 150 |
151 private: | 151 private: |
152 QuicDispatcher* dispatcher_; | 152 QuicDispatcher* dispatcher_; |
153 | 153 |
154 // Latched in OnUnauthenticatedPublicHeader for use later. | 154 // Latched in OnUnauthenticatedPublicHeader for use later. |
155 QuicConnectionId connection_id_; | 155 QuicConnectionId connection_id_; |
156 }; | 156 }; |
157 | 157 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // be parsed correctly. | 399 // be parsed correctly. |
400 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 400 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
401 header.connection_id)); | 401 header.connection_id)); |
402 | 402 |
403 // Continue parsing the packet to extract the sequence number. Then | 403 // Continue parsing the packet to extract the sequence number. Then |
404 // send it to the time wait manager in OnUnathenticatedHeader. | 404 // send it to the time wait manager in OnUnathenticatedHeader. |
405 return true; | 405 return true; |
406 } | 406 } |
407 | 407 |
408 } // namespace net | 408 } // namespace net |
OLD | NEW |