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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 const QuicCryptoServerConfig& crypto_config) { | 32 const QuicCryptoServerConfig& crypto_config) { |
33 return new QuicCryptoServerStream(crypto_config, this); | 33 return new QuicCryptoServerStream(crypto_config, this); |
34 } | 34 } |
35 | 35 |
36 void QuicServerSession::OnConnectionClosed(QuicErrorCode error, | 36 void QuicServerSession::OnConnectionClosed(QuicErrorCode error, |
37 bool from_peer) { | 37 bool from_peer) { |
38 QuicSession::OnConnectionClosed(error, from_peer); | 38 QuicSession::OnConnectionClosed(error, from_peer); |
39 owner_->OnConnectionClosed(connection()->guid(), error); | 39 owner_->OnConnectionClosed(connection()->guid(), error); |
40 } | 40 } |
41 | 41 |
42 bool QuicServerSession::ShouldCreateIncomingReliableStream(QuicStreamId id) { | 42 bool QuicServerSession::ShouldCreateIncomingDataStream(QuicStreamId id) { |
43 if (id % 2 == 0) { | 43 if (id % 2 == 0) { |
44 DLOG(INFO) << "Invalid incoming even stream_id:" << id; | 44 DLOG(INFO) << "Invalid incoming even stream_id:" << id; |
45 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); | 45 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); |
46 return false; | 46 return false; |
47 } | 47 } |
48 if (GetNumOpenStreams() >= get_max_open_streams()) { | 48 if (GetNumOpenStreams() >= get_max_open_streams()) { |
49 DLOG(INFO) << "Failed to create a new incoming stream with id:" << id | 49 DLOG(INFO) << "Failed to create a new incoming stream with id:" << id |
50 << " Already " << GetNumOpenStreams() << " open."; | 50 << " Already " << GetNumOpenStreams() << " open."; |
51 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); | 51 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); |
52 return false; | 52 return false; |
53 } | 53 } |
54 return true; | 54 return true; |
55 } | 55 } |
56 | 56 |
57 ReliableQuicStream* QuicServerSession::CreateIncomingReliableStream( | 57 QuicDataStream* QuicServerSession::CreateIncomingDataStream( |
58 QuicStreamId id) { | 58 QuicStreamId id) { |
59 if (!ShouldCreateIncomingReliableStream(id)) { | 59 if (!ShouldCreateIncomingDataStream(id)) { |
60 return NULL; | 60 return NULL; |
61 } | 61 } |
62 | 62 |
63 return new QuicSpdyServerStream(id, this); | 63 return new QuicSpdyServerStream(id, this); |
64 } | 64 } |
65 | 65 |
66 ReliableQuicStream* QuicServerSession::CreateOutgoingReliableStream() { | 66 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { |
67 DLOG(ERROR) << "Server push not yet supported"; | 67 DLOG(ERROR) << "Server push not yet supported"; |
68 return NULL; | 68 return NULL; |
69 } | 69 } |
70 | 70 |
71 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { | 71 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { |
72 return crypto_stream_.get(); | 72 return crypto_stream_.get(); |
73 } | 73 } |
74 | 74 |
75 } // namespace tools | 75 } // namespace tools |
76 } // namespace net | 76 } // namespace net |
OLD | NEW |