Windows should animate when they are about to get docked at screen edges.
[chromium-blink-merge.git] / net / tools / quic / quic_server_session.cc
blob7ec991c4aa982a75e53438ed9c44adb8f56eb836
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
3 // found in the LICENSE file.
5 #include "net/tools/quic/quic_server_session.h"
7 #include "base/logging.h"
8 #include "net/quic/reliable_quic_stream.h"
9 #include "net/tools/quic/quic_spdy_server_stream.h"
11 namespace net {
12 namespace tools {
14 QuicServerSession::QuicServerSession(
15 const QuicConfig& config,
16 QuicConnection* connection,
17 QuicSessionOwner* owner)
18 : QuicSession(connection, config, true),
19 owner_(owner) {
22 QuicServerSession::~QuicServerSession() {
25 void QuicServerSession::InitializeSession(
26 const QuicCryptoServerConfig& crypto_config) {
27 crypto_stream_.reset(CreateQuicCryptoServerStream(crypto_config));
30 QuicCryptoServerStream* QuicServerSession::CreateQuicCryptoServerStream(
31 const QuicCryptoServerConfig& crypto_config) {
32 return new QuicCryptoServerStream(crypto_config, this);
35 void QuicServerSession::ConnectionClose(QuicErrorCode error, bool from_peer) {
36 QuicSession::ConnectionClose(error, from_peer);
37 owner_->OnConnectionClose(connection()->guid(), error);
40 bool QuicServerSession::ShouldCreateIncomingReliableStream(QuicStreamId id) {
41 if (id % 2 == 0) {
42 DLOG(INFO) << "Invalid incoming even stream_id:" << id;
43 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID);
44 return false;
46 if (GetNumOpenStreams() >= get_max_open_streams()) {
47 DLOG(INFO) << "Failed to create a new incoming stream with id:" << id
48 << " Already " << GetNumOpenStreams() << " open.";
49 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS);
50 return false;
52 return true;
55 ReliableQuicStream* QuicServerSession::CreateIncomingReliableStream(
56 QuicStreamId id) {
57 if (!ShouldCreateIncomingReliableStream(id)) {
58 return NULL;
61 return new QuicSpdyServerStream(id, this);
64 ReliableQuicStream* QuicServerSession::CreateOutgoingReliableStream() {
65 DLOG(ERROR) << "Server push not yet supported";
66 return NULL;
69 QuicCryptoServerStream* QuicServerSession::GetCryptoStream() {
70 return crypto_stream_.get();
73 } // namespace tools
74 } // namespace net