| 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/quic/quic_chromium_client_session.h" | 5 #include "net/quic/quic_chromium_client_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 SSLInfo ssl_info; | 615 SSLInfo ssl_info; |
| 616 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert.get()) { | 616 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert.get()) { |
| 617 NOTREACHED() << "QUIC should always have certificates."; | 617 NOTREACHED() << "QUIC should always have certificates."; |
| 618 return false; | 618 return false; |
| 619 } | 619 } |
| 620 | 620 |
| 621 return SpdySession::CanPool(transport_security_state_, ssl_info, | 621 return SpdySession::CanPool(transport_security_state_, ssl_info, |
| 622 server_id_.host(), hostname); | 622 server_id_.host(), hostname); |
| 623 } | 623 } |
| 624 | 624 |
| 625 QuicSpdyStream* QuicChromiumClientSession::CreateIncomingDynamicStream( | 625 QuicChromiumClientStream* |
| 626 QuicStreamId id) { | 626 QuicChromiumClientSession::CreateIncomingDynamicStream(QuicStreamId id) { |
| 627 DLOG(ERROR) << "Server push not supported"; | 627 if (!connection()->connected()) { |
| 628 return nullptr; | 628 LOG(DFATAL) << "ShouldCreateIncomingDynamicStream called when disconnected"; |
| 629 return nullptr; |
| 630 } |
| 631 if (goaway_received()) { |
| 632 DVLOG(1) << "Failed to create a new outgoing stream. " |
| 633 << "Already received goaway."; |
| 634 return nullptr; |
| 635 } |
| 636 if (going_away_) { |
| 637 return nullptr; |
| 638 } |
| 639 if (id % 2 != 0) { |
| 640 LOG(WARNING) << "Received invalid push stream id " << id; |
| 641 connection()->SendConnectionCloseWithDetails( |
| 642 QUIC_INVALID_STREAM_ID, "Server created odd numbered stream"); |
| 643 return nullptr; |
| 644 } |
| 645 return CreateIncomingReliableStreamImpl(id); |
| 646 } |
| 647 |
| 648 QuicChromiumClientStream* |
| 649 QuicChromiumClientSession::CreateIncomingReliableStreamImpl(QuicStreamId id) { |
| 650 DCHECK(connection()->connected()); |
| 651 QuicChromiumClientStream* stream = |
| 652 new QuicChromiumClientStream(id, this, net_log_); |
| 653 stream->CloseWriteSide(); |
| 654 ++num_total_streams_; |
| 655 return stream; |
| 629 } | 656 } |
| 630 | 657 |
| 631 void QuicChromiumClientSession::CloseStream(QuicStreamId stream_id) { | 658 void QuicChromiumClientSession::CloseStream(QuicStreamId stream_id) { |
| 632 ReliableQuicStream* stream = GetStream(stream_id); | 659 ReliableQuicStream* stream = GetStream(stream_id); |
| 633 if (stream) { | 660 if (stream) { |
| 634 logger_->UpdateReceivedFrameCounts(stream_id, stream->num_frames_received(), | 661 logger_->UpdateReceivedFrameCounts(stream_id, stream->num_frames_received(), |
| 635 stream->num_duplicate_frames_received()); | 662 stream->num_duplicate_frames_received()); |
| 636 } | 663 } |
| 637 QuicSpdySession::CloseStream(stream_id); | 664 QuicSpdySession::CloseStream(stream_id); |
| 638 OnClosedStream(); | 665 OnClosedStream(); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 DCHECK(sockets_.back().get() != nullptr); | 1102 DCHECK(sockets_.back().get() != nullptr); |
| 1076 // The most recently added socket is the currently active one. | 1103 // The most recently added socket is the currently active one. |
| 1077 return sockets_.back().get(); | 1104 return sockets_.back().get(); |
| 1078 } | 1105 } |
| 1079 | 1106 |
| 1080 bool QuicChromiumClientSession::IsAuthorized(const std::string& hostname) { | 1107 bool QuicChromiumClientSession::IsAuthorized(const std::string& hostname) { |
| 1081 return CanPool(hostname, server_id_.privacy_mode()); | 1108 return CanPool(hostname, server_id_.privacy_mode()); |
| 1082 } | 1109 } |
| 1083 | 1110 |
| 1084 } // namespace net | 1111 } // namespace net |
| OLD | NEW |