| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 if (stream) { | 68 if (stream) { |
| 69 SignalIncomingStream(stream); | 69 SignalIncomingStream(stream); |
| 70 } | 70 } |
| 71 return stream; | 71 return stream; |
| 72 } | 72 } |
| 73 | 73 |
| 74 ReliableQuicStream* QuicSession::CreateOutgoingDynamicStream( | 74 ReliableQuicStream* QuicSession::CreateOutgoingDynamicStream( |
| 75 net::SpdyPriority priority) { | 75 net::SpdyPriority priority) { |
| 76 ReliableQuicStream* stream = CreateDataStream(GetNextOutgoingStreamId()); | 76 ReliableQuicStream* stream = CreateDataStream(GetNextOutgoingStreamId()); |
| 77 if (stream) { | 77 if (stream) { |
| 78 ActivateStream(stream); | 78 ActivateStream(stream); // QuicSession owns the stream. |
| 79 } | 79 } |
| 80 return stream; | 80 return stream; |
| 81 } | 81 } |
| 82 | 82 |
| 83 ReliableQuicStream* QuicSession::CreateDataStream(net::QuicStreamId id) { | 83 ReliableQuicStream* QuicSession::CreateDataStream(net::QuicStreamId id) { |
| 84 if (crypto_stream_ == nullptr || !crypto_stream_->encryption_established()) { | 84 if (crypto_stream_ == nullptr || !crypto_stream_->encryption_established()) { |
| 85 // Encryption not active so no stream created | 85 return nullptr; // Encryption not active so no stream created |
| 86 return nullptr; | |
| 87 } | 86 } |
| 88 return new ReliableQuicStream(id, this); | 87 return new ReliableQuicStream(id, this); |
| 89 } | 88 } |
| 90 | 89 |
| 91 void QuicSession::OnConnectionClosed(net::QuicErrorCode error, | 90 void QuicSession::OnConnectionClosed(net::QuicErrorCode error, |
| 92 net::ConnectionCloseSource source) { | 91 net::ConnectionCloseSource source) { |
| 93 net::QuicSession::OnConnectionClosed(error, source); | 92 net::QuicSession::OnConnectionClosed(error, source); |
| 94 SignalConnectionClosed(error, | 93 SignalConnectionClosed(error, |
| 95 source == net::ConnectionCloseSource::FROM_PEER); | 94 source == net::ConnectionCloseSource::FROM_PEER); |
| 96 } | 95 } |
| 97 | 96 |
| 98 bool QuicSession::OnReadPacket(const char* data, size_t data_len) { | 97 bool QuicSession::OnReadPacket(const char* data, size_t data_len) { |
| 99 net::QuicEncryptedPacket packet(data, data_len); | 98 net::QuicEncryptedPacket packet(data, data_len); |
| 100 connection()->ProcessUdpPacket(connection()->self_address(), | 99 connection()->ProcessUdpPacket(connection()->self_address(), |
| 101 connection()->peer_address(), packet); | 100 connection()->peer_address(), packet); |
| 102 return true; | 101 return true; |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace cricket | 104 } // namespace cricket |
| OLD | NEW |