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/crypto/source_address_token.h" | 8 #include "net/quic/crypto/source_address_token.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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 bool QuicServerSession::ShouldCreateIncomingDataStream(QuicStreamId id) { | 139 bool QuicServerSession::ShouldCreateIncomingDataStream(QuicStreamId id) { |
140 if (id % 2 == 0) { | 140 if (id % 2 == 0) { |
141 DVLOG(1) << "Invalid incoming even stream_id:" << id; | 141 DVLOG(1) << "Invalid incoming even stream_id:" << id; |
142 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); | 142 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); |
143 return false; | 143 return false; |
144 } | 144 } |
145 if (GetNumOpenStreams() >= get_max_open_streams()) { | 145 if (GetNumOpenStreams() >= get_max_open_streams()) { |
146 DVLOG(1) << "Failed to create a new incoming stream with id:" << id | 146 DVLOG(1) << "Failed to create a new incoming stream with id:" << id |
147 << " Already " << GetNumOpenStreams() << " open."; | 147 << " Already " << GetNumOpenStreams() << " streams open (max " |
| 148 << get_max_open_streams() << ")."; |
148 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); | 149 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS); |
149 return false; | 150 return false; |
150 } | 151 } |
151 return true; | 152 return true; |
152 } | 153 } |
153 | 154 |
154 QuicDataStream* QuicServerSession::CreateIncomingDataStream( | 155 QuicDataStream* QuicServerSession::CreateIncomingDataStream( |
155 QuicStreamId id) { | 156 QuicStreamId id) { |
156 if (!ShouldCreateIncomingDataStream(id)) { | 157 if (!ShouldCreateIncomingDataStream(id)) { |
157 return NULL; | 158 return NULL; |
158 } | 159 } |
159 | 160 |
160 return new QuicSpdyServerStream(id, this); | 161 return new QuicSpdyServerStream(id, this); |
161 } | 162 } |
162 | 163 |
163 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { | 164 QuicDataStream* QuicServerSession::CreateOutgoingDataStream() { |
164 DLOG(ERROR) << "Server push not yet supported"; | 165 DLOG(ERROR) << "Server push not yet supported"; |
165 return NULL; | 166 return NULL; |
166 } | 167 } |
167 | 168 |
168 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { | 169 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() { |
169 return crypto_stream_.get(); | 170 return crypto_stream_.get(); |
170 } | 171 } |
171 | 172 |
172 } // namespace net | 173 } // namespace net |
OLD | NEW |