OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/p2p/quic_p2p_session.h" | 5 #include "net/quic/p2p/quic_p2p_session.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
8 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
9 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
10 #include "net/quic/p2p/quic_p2p_crypto_stream.h" | 12 #include "net/quic/p2p/quic_p2p_crypto_stream.h" |
11 #include "net/quic/p2p/quic_p2p_stream.h" | 13 #include "net/quic/p2p/quic_p2p_stream.h" |
12 #include "net/quic/quic_connection.h" | 14 #include "net/quic/quic_connection.h" |
13 #include "net/socket/socket.h" | 15 #include "net/socket/socket.h" |
14 | 16 |
15 namespace net { | 17 namespace net { |
16 | 18 |
17 QuicP2PSession::QuicP2PSession(const QuicConfig& config, | 19 QuicP2PSession::QuicP2PSession(const QuicConfig& config, |
18 const QuicP2PCryptoConfig& crypto_config, | 20 const QuicP2PCryptoConfig& crypto_config, |
19 scoped_ptr<QuicConnection> connection, | 21 scoped_ptr<QuicConnection> connection, |
20 scoped_ptr<net::Socket> socket) | 22 scoped_ptr<net::Socket> socket) |
21 : QuicSession(connection.release(), config), | 23 : QuicSession(connection.release(), config), |
22 socket_(socket.Pass()), | 24 socket_(std::move(socket)), |
23 crypto_stream_(new QuicP2PCryptoStream(this, crypto_config)), | 25 crypto_stream_(new QuicP2PCryptoStream(this, crypto_config)), |
24 read_buffer_(new net::IOBuffer(static_cast<size_t>(kMaxPacketSize))) { | 26 read_buffer_(new net::IOBuffer(static_cast<size_t>(kMaxPacketSize))) { |
25 DCHECK(config.negotiated()); | 27 DCHECK(config.negotiated()); |
26 | 28 |
27 // Non-null IP address needs to be passed here because QuicConnection uses | 29 // Non-null IP address needs to be passed here because QuicConnection uses |
28 // ToString() to format addresses for logging and ToString() is not allowed | 30 // ToString() to format addresses for logging and ToString() is not allowed |
29 // for empty addresses. | 31 // for empty addresses. |
30 // TODO(sergeyu): Fix QuicConnection and remove SetSelfAddress() call below. | 32 // TODO(sergeyu): Fix QuicConnection and remove SetSelfAddress() call below. |
31 net::IPAddressNumber ip(net::kIPv4AddressSize, 0); | 33 net::IPAddressNumber ip(net::kIPv4AddressSize, 0); |
32 this->connection()->SetSelfAddress(net::IPEndPoint(ip, 0)); | 34 this->connection()->SetSelfAddress(net::IPEndPoint(ip, 0)); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return result; | 121 return result; |
120 } | 122 } |
121 | 123 |
122 QuicEncryptedPacket packet(read_buffer_->data(), result); | 124 QuicEncryptedPacket packet(read_buffer_->data(), result); |
123 connection()->ProcessUdpPacket(connection()->self_address(), | 125 connection()->ProcessUdpPacket(connection()->self_address(), |
124 connection()->peer_address(), packet); | 126 connection()->peer_address(), packet); |
125 return OK; | 127 return OK; |
126 } | 128 } |
127 | 129 |
128 } // namespace net | 130 } // namespace net |
OLD | NEW |