dschinazi | 1c99fcf | 2019-12-13 11:54:22 -0800 | [diff] [blame] | 1 | // Copyright 2019 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. |
| 4 | |
| 5 | #include "net/third_party/quiche/src/quic/masque/masque_encapsulated_client_session.h" |
| 6 | |
| 7 | namespace quic { |
| 8 | |
| 9 | MasqueEncapsulatedClientSession::MasqueEncapsulatedClientSession( |
| 10 | const QuicConfig& config, |
| 11 | const ParsedQuicVersionVector& supported_versions, |
| 12 | QuicConnection* connection, |
| 13 | const QuicServerId& server_id, |
| 14 | QuicCryptoClientConfig* crypto_config, |
| 15 | QuicClientPushPromiseIndex* push_promise_index, |
| 16 | MasqueClientSession* masque_client_session) |
| 17 | : QuicSpdyClientSession(config, |
| 18 | supported_versions, |
| 19 | connection, |
| 20 | server_id, |
| 21 | crypto_config, |
| 22 | push_promise_index), |
| 23 | masque_client_session_(masque_client_session) {} |
| 24 | |
| 25 | void MasqueEncapsulatedClientSession::ProcessPacket( |
| 26 | quiche::QuicheStringPiece packet, |
| 27 | QuicSocketAddress server_address) { |
| 28 | QuicTime now = connection()->clock()->ApproximateNow(); |
| 29 | QuicReceivedPacket received_packet(packet.data(), packet.length(), now); |
| 30 | connection()->ProcessUdpPacket(connection()->self_address(), server_address, |
| 31 | received_packet); |
| 32 | } |
| 33 | |
| 34 | void MasqueEncapsulatedClientSession::OnConnectionClosed( |
| 35 | const QuicConnectionCloseFrame& /*frame*/, |
| 36 | ConnectionCloseSource /*source*/) { |
| 37 | masque_client_session_->UnregisterConnectionId( |
| 38 | connection()->client_connection_id()); |
| 39 | } |
| 40 | |
| 41 | } // namespace quic |