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> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 : QuicSession(connection.release(), config), | 24 : QuicSession(connection.release(), config), |
25 socket_(std::move(socket)), | 25 socket_(std::move(socket)), |
26 crypto_stream_(new QuicP2PCryptoStream(this, crypto_config)), | 26 crypto_stream_(new QuicP2PCryptoStream(this, crypto_config)), |
27 read_buffer_(new IOBuffer(static_cast<size_t>(kMaxPacketSize))) { | 27 read_buffer_(new IOBuffer(static_cast<size_t>(kMaxPacketSize))) { |
28 DCHECK(config.negotiated()); | 28 DCHECK(config.negotiated()); |
29 | 29 |
30 // Non-null IP address needs to be passed here because QuicConnection uses | 30 // Non-null IP address needs to be passed here because QuicConnection uses |
31 // ToString() to format addresses for logging and ToString() is not allowed | 31 // ToString() to format addresses for logging and ToString() is not allowed |
32 // for empty addresses. | 32 // for empty addresses. |
33 // TODO(sergeyu): Fix QuicConnection and remove SetSelfAddress() call below. | 33 // TODO(sergeyu): Fix QuicConnection and remove SetSelfAddress() call below. |
34 this->connection()->SetSelfAddress(IPEndPoint(IPAddress(0, 0, 0, 0), 0)); | 34 this->connection()->SetSelfAddress(IPEndPoint(IPAddress::IPv4AllZeros(), 0)); |
35 } | 35 } |
36 | 36 |
37 QuicP2PSession::~QuicP2PSession() {} | 37 QuicP2PSession::~QuicP2PSession() {} |
38 | 38 |
39 void QuicP2PSession::Initialize() { | 39 void QuicP2PSession::Initialize() { |
40 QuicSession::Initialize(); | 40 QuicSession::Initialize(); |
41 crypto_stream_->Connect(); | 41 crypto_stream_->Connect(); |
42 DoReadLoop(OK); | 42 DoReadLoop(OK); |
43 } | 43 } |
44 | 44 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return result; | 124 return result; |
125 } | 125 } |
126 | 126 |
127 QuicEncryptedPacket packet(read_buffer_->data(), result); | 127 QuicEncryptedPacket packet(read_buffer_->data(), result); |
128 connection()->ProcessUdpPacket(connection()->self_address(), | 128 connection()->ProcessUdpPacket(connection()->self_address(), |
129 connection()->peer_address(), packet); | 129 connection()->peer_address(), packet); |
130 return OK; | 130 return OK; |
131 } | 131 } |
132 | 132 |
133 } // namespace net | 133 } // namespace net |
OLD | NEW |