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/tools/quic/quic_server_session.h" | 5 #include "net/tools/quic/quic_server_session.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/proto/cached_network_parameters.pb.h" | 8 #include "net/quic/proto/cached_network_parameters.pb.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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 crypto_stream_->SendServerConfigUpdate(&cached_network_params); | 168 crypto_stream_->SendServerConfigUpdate(&cached_network_params); |
169 | 169 |
170 connection()->OnSendConnectionState(cached_network_params); | 170 connection()->OnSendConnectionState(cached_network_params); |
171 | 171 |
172 last_scup_time_ = now; | 172 last_scup_time_ = now; |
173 last_scup_sequence_number_ = | 173 last_scup_sequence_number_ = |
174 connection()->sequence_number_of_last_sent_packet(); | 174 connection()->sequence_number_of_last_sent_packet(); |
175 } | 175 } |
176 | 176 |
177 bool QuicServerSession::ShouldCreateIncomingDataStream(QuicStreamId id) { | 177 bool QuicServerSession::ShouldCreateIncomingDataStream(QuicStreamId id) { |
| 178 if (!connection()->connected()) { |
| 179 LOG(DFATAL) << "ShouldCreateIncomingDataStream called when disconnected"; |
| 180 return false; |
| 181 } |
| 182 |
178 if (id % 2 == 0) { | 183 if (id % 2 == 0) { |
179 DVLOG(1) << "Invalid incoming even stream_id:" << id; | 184 DVLOG(1) << "Invalid incoming even stream_id:" << id; |
180 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); | 185 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); |
181 return false; | 186 return false; |
182 } | 187 } |
183 if (GetNumOpenStreams() >= get_max_open_streams()) { | 188 if (GetNumOpenStreams() >= get_max_open_streams()) { |
184 DVLOG(1) << "Failed to create a new incoming stream with id:" << id | 189 DVLOG(1) << "Failed to create a new incoming stream with id:" << id |
185 << " Already " << GetNumOpenStreams() << " streams open (max " | 190 << " Already " << GetNumOpenStreams() << " streams open (max " |
186 << get_max_open_streams() << ")."; | 191 << get_max_open_streams() << ")."; |
187 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); | 192 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); |
(...skipping 15 matching lines...) Expand all Loading... |
203 DLOG(ERROR) << "Server push not yet supported"; | 208 DLOG(ERROR) << "Server push not yet supported"; |
204 return nullptr; | 209 return nullptr; |
205 } | 210 } |
206 | 211 |
207 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { | 212 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { |
208 return crypto_stream_.get(); | 213 return crypto_stream_.get(); |
209 } | 214 } |
210 | 215 |
211 } // namespace tools | 216 } // namespace tools |
212 } // namespace net | 217 } // namespace net |
OLD | NEW |