| 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" |
| 11 #include "net/quic/quic_spdy_session.h" | 11 #include "net/quic/quic_spdy_session.h" |
| 12 #include "net/quic/reliable_quic_stream.h" | 12 #include "net/quic/reliable_quic_stream.h" |
| 13 #include "net/tools/quic/quic_spdy_server_stream.h" | 13 #include "net/tools/quic/quic_simple_server_stream.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 namespace tools { | 16 namespace tools { |
| 17 | 17 |
| 18 QuicServerSession::QuicServerSession( | 18 QuicServerSession::QuicServerSession( |
| 19 const QuicConfig& config, | 19 const QuicConfig& config, |
| 20 QuicConnection* connection, | 20 QuicConnection* connection, |
| 21 QuicServerSessionVisitor* visitor, | 21 QuicServerSessionVisitor* visitor, |
| 22 const QuicCryptoServerConfig* crypto_config) | 22 const QuicCryptoServerConfig* crypto_config) |
| 23 : QuicSpdySession(connection, config), | 23 : QuicSpdySession(connection, config), |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 return true; | 196 return true; |
| 197 } | 197 } |
| 198 | 198 |
| 199 QuicSpdyStream* QuicServerSession::CreateIncomingDynamicStream( | 199 QuicSpdyStream* QuicServerSession::CreateIncomingDynamicStream( |
| 200 QuicStreamId id) { | 200 QuicStreamId id) { |
| 201 if (!ShouldCreateIncomingDynamicStream(id)) { | 201 if (!ShouldCreateIncomingDynamicStream(id)) { |
| 202 return nullptr; | 202 return nullptr; |
| 203 } | 203 } |
| 204 | 204 |
| 205 return new QuicSpdyServerStream(id, this); | 205 return new QuicSimpleServerStream(id, this); |
| 206 } | 206 } |
| 207 | 207 |
| 208 bool QuicServerSession::ShouldCreateOutgoingDynamicStream() { | 208 bool QuicServerSession::ShouldCreateOutgoingDynamicStream() { |
| 209 if (!connection()->connected()) { | 209 if (!connection()->connected()) { |
| 210 LOG(DFATAL) << "ShouldCreateOutgoingDynamicStream called when disconnected"; | 210 LOG(DFATAL) << "ShouldCreateOutgoingDynamicStream called when disconnected"; |
| 211 return false; | 211 return false; |
| 212 } | 212 } |
| 213 if (!crypto_stream_->encryption_established()) { | 213 if (!crypto_stream_->encryption_established()) { |
| 214 LOG(DFATAL) << "Encryption not established so no outgoing stream created."; | 214 LOG(DFATAL) << "Encryption not established so no outgoing stream created."; |
| 215 return false; | 215 return false; |
| 216 } | 216 } |
| 217 if (GetNumOpenOutgoingStreams() >= get_max_open_streams()) { | 217 if (GetNumOpenOutgoingStreams() >= get_max_open_streams()) { |
| 218 VLOG(1) << "No more streams should be created. " | 218 VLOG(1) << "No more streams should be created. " |
| 219 << "Already " << GetNumOpenOutgoingStreams() << " open."; | 219 << "Already " << GetNumOpenOutgoingStreams() << " open."; |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 return true; | 222 return true; |
| 223 } | 223 } |
| 224 | 224 |
| 225 QuicSpdyStream* QuicServerSession::CreateOutgoingDynamicStream( | 225 QuicSpdyStream* QuicServerSession::CreateOutgoingDynamicStream( |
| 226 SpdyPriority priority) { | 226 SpdyPriority priority) { |
| 227 if (!ShouldCreateOutgoingDynamicStream()) { | 227 if (!ShouldCreateOutgoingDynamicStream()) { |
| 228 return nullptr; | 228 return nullptr; |
| 229 } | 229 } |
| 230 | 230 |
| 231 QuicSpdyStream* stream = | 231 QuicSpdyStream* stream = |
| 232 new QuicSpdyServerStream(GetNextOutgoingStreamId(), this); | 232 new QuicSimpleServerStream(GetNextOutgoingStreamId(), this); |
| 233 stream->SetPriority(priority); | 233 stream->SetPriority(priority); |
| 234 ActivateStream(stream); | 234 ActivateStream(stream); |
| 235 return stream; | 235 return stream; |
| 236 } | 236 } |
| 237 | 237 |
| 238 QuicCryptoServerStreamBase* QuicServerSession::GetCryptoStream() { | 238 QuicCryptoServerStreamBase* QuicServerSession::GetCryptoStream() { |
| 239 return crypto_stream_.get(); | 239 return crypto_stream_.get(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace tools | 242 } // namespace tools |
| 243 } // namespace net | 243 } // namespace net |
| OLD | NEW |