| 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/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
| 9 #include "net/quic/reliable_quic_stream.h" | 9 #include "net/quic/reliable_quic_stream.h" |
| 10 #include "net/tools/quic/quic_spdy_server_stream.h" | 10 #include "net/tools/quic/quic_spdy_server_stream.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 namespace tools { | 13 namespace tools { |
| 14 | 14 |
| 15 QuicServerSession::QuicServerSession( | 15 QuicServerSession::QuicServerSession(const QuicConfig& config, |
| 16 const QuicConfig& config, | 16 QuicConnection* connection, |
| 17 QuicConnection* connection, | 17 QuicServerSessionVisitor* visitor) |
| 18 QuicServerSessionVisitor* visitor) | 18 : QuicSession(connection, config), visitor_(visitor) { |
| 19 : QuicSession(connection, config), | 19 } |
| 20 visitor_(visitor) {} | |
| 21 | 20 |
| 22 QuicServerSession::~QuicServerSession() {} | 21 QuicServerSession::~QuicServerSession() { |
| 22 } |
| 23 | 23 |
| 24 void QuicServerSession::InitializeSession( | 24 void QuicServerSession::InitializeSession( |
| 25 const QuicCryptoServerConfig& crypto_config) { | 25 const QuicCryptoServerConfig& crypto_config) { |
| 26 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config)); | 26 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream( | 29 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream( |
| 30 const QuicCryptoServerConfig& crypto_config) { | 30 const QuicCryptoServerConfig& crypto_config) { |
| 31 return new QuicCryptoServerStream(crypto_config, this); | 31 return new QuicCryptoServerStream(crypto_config, this); |
| 32 } | 32 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 55 } | 55 } |
| 56 if (GetNumOpenStreams() >= get_max_open_streams()) { | 56 if (GetNumOpenStreams() >= get_max_open_streams()) { |
| 57 DVLOG(1) << "Failed to create a new incoming stream with id:" << id | 57 DVLOG(1) << "Failed to create a new incoming stream with id:" << id |
| 58 << " Already " << GetNumOpenStreams() << " open."; | 58 << " Already " << GetNumOpenStreams() << " open."; |
| 59 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); | 59 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 QuicDataStream* QuicServerSession::CreateIncomingDataStream( | 65 QuicDataStream* QuicServerSession::CreateIncomingDataStream(QuicStreamId id) { |
| 66 QuicStreamId id) { | |
| 67 if (!ShouldCreateIncomingDataStream(id)) { | 66 if (!ShouldCreateIncomingDataStream(id)) { |
| 68 return NULL; | 67 return NULL; |
| 69 } | 68 } |
| 70 | 69 |
| 71 return new QuicSpdyServerStream(id, this); | 70 return new QuicSpdyServerStream(id, this); |
| 72 } | 71 } |
| 73 | 72 |
| 74 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { | 73 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { |
| 75 DLOG(ERROR) << "Server push not yet supported"; | 74 DLOG(ERROR) << "Server push not yet supported"; |
| 76 return NULL; | 75 return NULL; |
| 77 } | 76 } |
| 78 | 77 |
| 79 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { | 78 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { |
| 80 return crypto_stream_.get(); | 79 return crypto_stream_.get(); |
| 81 } | 80 } |
| 82 | 81 |
| 83 } // namespace tools | 82 } // namespace tools |
| 84 } // namespace net | 83 } // namespace net |
| OLD | NEW |