| 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_server_session.h" | 5 #include "net/quic/quic_server_session.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
| 9 #include "net/quic/quic_flags.h" |
| 9 #include "net/quic/quic_spdy_server_stream.h" | 10 #include "net/quic/quic_spdy_server_stream.h" |
| 10 #include "net/quic/reliable_quic_stream.h" | 11 #include "net/quic/reliable_quic_stream.h" |
| 11 | 12 |
| 12 namespace net { | 13 namespace net { |
| 13 | 14 |
| 14 QuicServerSession::QuicServerSession(const QuicConfig& config, | 15 QuicServerSession::QuicServerSession(const QuicConfig& config, |
| 15 QuicConnection* connection, | 16 QuicConnection* connection, |
| 16 QuicServerSessionVisitor* visitor) | 17 QuicServerSessionVisitor* visitor) |
| 17 : QuicSession(connection, config), | 18 : QuicSession(connection, config), |
| 18 visitor_(visitor) {} | 19 visitor_(visitor) {} |
| 19 | 20 |
| 20 QuicServerSession::~QuicServerSession() {} | 21 QuicServerSession::~QuicServerSession() {} |
| 21 | 22 |
| 22 void QuicServerSession::InitializeSession( | 23 void QuicServerSession::InitializeSession( |
| 23 const QuicCryptoServerConfig& crypto_config) { | 24 const QuicCryptoServerConfig& crypto_config) { |
| 24 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config)); | 25 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config)); |
| 25 } | 26 } |
| 26 | 27 |
| 27 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream( | 28 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream( |
| 28 const QuicCryptoServerConfig& crypto_config) { | 29 const QuicCryptoServerConfig& crypto_config) { |
| 29 return new QuicCryptoServerStream(crypto_config, this); | 30 return new QuicCryptoServerStream(crypto_config, this); |
| 30 } | 31 } |
| 31 | 32 |
| 33 void QuicServerSession::OnConfigNegotiated() { |
| 34 QuicSession::OnConfigNegotiated(); |
| 35 if (!FLAGS_enable_quic_fec || |
| 36 !config()->HasReceivedConnectionOptions() || |
| 37 !ContainsQuicTag(config()->ReceivedConnectionOptions(), kFHDR)) { |
| 38 return; |
| 39 } |
| 40 // kFHDR config maps to FEC protection always for headers stream. |
| 41 // TODO(jri): Add crypto stream in addition to headers for kHDR. |
| 42 headers_stream_->set_fec_policy(FEC_PROTECT_ALWAYS); |
| 43 } |
| 44 |
| 32 void QuicServerSession::OnConnectionClosed(QuicErrorCode error, | 45 void QuicServerSession::OnConnectionClosed(QuicErrorCode error, |
| 33 bool from_peer) { | 46 bool from_peer) { |
| 34 QuicSession::OnConnectionClosed(error, from_peer); | 47 QuicSession::OnConnectionClosed(error, from_peer); |
| 35 // In the unlikely event we get a connection close while doing an asynchronous | 48 // In the unlikely event we get a connection close while doing an asynchronous |
| 36 // crypto event, make sure we cancel the callback. | 49 // crypto event, make sure we cancel the callback. |
| 37 if (crypto_stream_.get() != NULL) { | 50 if (crypto_stream_.get() != NULL) { |
| 38 crypto_stream_->CancelOutstandingCallbacks(); | 51 crypto_stream_->CancelOutstandingCallbacks(); |
| 39 } | 52 } |
| 40 visitor_->OnConnectionClosed(connection()->connection_id(), error); | 53 visitor_->OnConnectionClosed(connection()->connection_id(), error); |
| 41 } | 54 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 72 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { | 85 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { |
| 73 DLOG(ERROR) << "Server push not yet supported"; | 86 DLOG(ERROR) << "Server push not yet supported"; |
| 74 return NULL; | 87 return NULL; |
| 75 } | 88 } |
| 76 | 89 |
| 77 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { | 90 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { |
| 78 return crypto_stream_.get(); | 91 return crypto_stream_.get(); |
| 79 } | 92 } |
| 80 | 93 |
| 81 } // namespace net | 94 } // namespace net |
| OLD | NEW |