Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 net::QuicSession::OnCryptoHandshakeEvent(event); | 55 net::QuicSession::OnCryptoHandshakeEvent(event); |
| 56 if (event == HANDSHAKE_CONFIRMED) { | 56 if (event == HANDSHAKE_CONFIRMED) { |
| 57 LOG(LS_INFO) << "QuicSession handshake complete"; | 57 LOG(LS_INFO) << "QuicSession handshake complete"; |
| 58 RTC_DCHECK(IsEncryptionEstablished()); | 58 RTC_DCHECK(IsEncryptionEstablished()); |
| 59 RTC_DCHECK(IsCryptoHandshakeConfirmed()); | 59 RTC_DCHECK(IsCryptoHandshakeConfirmed()); |
| 60 | 60 |
| 61 SignalHandshakeComplete(); | 61 SignalHandshakeComplete(); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 void QuicSession::CloseStream(net::QuicStreamId stream_id) { | |
| 66 if (IsClosedStream(stream_id)) { | |
| 67 // When CloseStream has been called recursively (via | |
| 68 // ReliableQuicStream::OnClose), the stream is already closed so return. | |
| 69 return; | |
| 70 } | |
| 71 if (!IsIncomingStream(stream_id)) { | |
|
pthatcher1
2016/04/29 20:15:46
What happens if we call write_blocked_streams()->U
mikescarlett
2016/04/29 23:29:50
write_blocked_streams()->UnregisterStream(stream_i
| |
| 72 write_blocked_streams()->UnregisterStream(stream_id); | |
| 73 } | |
| 74 net::QuicSession::CloseStream(stream_id); | |
| 75 } | |
| 76 | |
| 65 ReliableQuicStream* QuicSession::CreateIncomingDynamicStream( | 77 ReliableQuicStream* QuicSession::CreateIncomingDynamicStream( |
| 66 net::QuicStreamId id) { | 78 net::QuicStreamId id) { |
| 67 ReliableQuicStream* stream = CreateDataStream(id); | 79 ReliableQuicStream* stream = CreateDataStream(id); |
| 68 if (stream) { | 80 if (stream) { |
| 69 SignalIncomingStream(stream); | 81 SignalIncomingStream(stream); |
| 70 } | 82 } |
| 71 return stream; | 83 return stream; |
| 72 } | 84 } |
| 73 | 85 |
| 74 ReliableQuicStream* QuicSession::CreateOutgoingDynamicStream( | 86 ReliableQuicStream* QuicSession::CreateOutgoingDynamicStream( |
| 75 net::SpdyPriority priority) { | 87 net::SpdyPriority priority) { |
| 76 ReliableQuicStream* stream = CreateDataStream(GetNextOutgoingStreamId()); | 88 ReliableQuicStream* stream = CreateDataStream(GetNextOutgoingStreamId()); |
| 77 if (stream) { | 89 if (stream) { |
| 78 ActivateStream(stream); // QuicSession owns the stream. | 90 ActivateStream(stream); // QuicSession owns the stream. |
| 91 // Register the stream to the QuicWriteBlockedList. |priority| is clamped | |
| 92 // between 0 and 7, with 0 being the highest priority and 7 the lowest | |
| 93 // priority. | |
| 94 write_blocked_streams()->RegisterStream(stream->id(), priority); | |
| 79 } | 95 } |
| 80 return stream; | 96 return stream; |
| 81 } | 97 } |
| 82 | 98 |
| 83 ReliableQuicStream* QuicSession::CreateDataStream(net::QuicStreamId id) { | 99 ReliableQuicStream* QuicSession::CreateDataStream(net::QuicStreamId id) { |
| 84 if (crypto_stream_ == nullptr || !crypto_stream_->encryption_established()) { | 100 if (crypto_stream_ == nullptr || !crypto_stream_->encryption_established()) { |
| 85 // Encryption not active so no stream created | 101 // Encryption not active so no stream created |
| 86 return nullptr; | 102 return nullptr; |
| 87 } | 103 } |
| 88 return new ReliableQuicStream(id, this); | 104 return new ReliableQuicStream(id, this); |
| 89 } | 105 } |
| 90 | 106 |
| 91 void QuicSession::OnConnectionClosed(net::QuicErrorCode error, | 107 void QuicSession::OnConnectionClosed(net::QuicErrorCode error, |
| 92 net::ConnectionCloseSource source) { | 108 net::ConnectionCloseSource source) { |
| 93 net::QuicSession::OnConnectionClosed(error, source); | 109 net::QuicSession::OnConnectionClosed(error, source); |
| 94 SignalConnectionClosed(error, | 110 SignalConnectionClosed(error, |
| 95 source == net::ConnectionCloseSource::FROM_PEER); | 111 source == net::ConnectionCloseSource::FROM_PEER); |
| 96 } | 112 } |
| 97 | 113 |
| 98 bool QuicSession::OnReadPacket(const char* data, size_t data_len) { | 114 bool QuicSession::OnReadPacket(const char* data, size_t data_len) { |
| 99 net::QuicEncryptedPacket packet(data, data_len); | 115 net::QuicEncryptedPacket packet(data, data_len); |
| 100 connection()->ProcessUdpPacket(connection()->self_address(), | 116 connection()->ProcessUdpPacket(connection()->self_address(), |
| 101 connection()->peer_address(), packet); | 117 connection()->peer_address(), packet); |
| 102 return true; | 118 return true; |
| 103 } | 119 } |
| 104 | 120 |
| 105 } // namespace cricket | 121 } // namespace cricket |
| OLD | NEW |