OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/p2p/socket_host_udp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <deque> | 8 #include <deque> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 int GetPeerAddress(net::IPEndPoint* address) const override { | 65 int GetPeerAddress(net::IPEndPoint* address) const override { |
66 NOTREACHED(); | 66 NOTREACHED(); |
67 return net::ERR_SOCKET_NOT_CONNECTED; | 67 return net::ERR_SOCKET_NOT_CONNECTED; |
68 } | 68 } |
69 | 69 |
70 int GetLocalAddress(net::IPEndPoint* address) const override { | 70 int GetLocalAddress(net::IPEndPoint* address) const override { |
71 *address = address_; | 71 *address = address_; |
72 return 0; | 72 return 0; |
73 } | 73 } |
74 | 74 |
75 void UseNonBlockingIO() override {} | |
76 | |
77 int Listen(const net::IPEndPoint& address) override { | 75 int Listen(const net::IPEndPoint& address) override { |
78 if (used_ports_) { | 76 if (used_ports_) { |
79 for (auto used_port : *used_ports_) { | 77 for (auto used_port : *used_ports_) { |
80 if (used_port == address.port()) | 78 if (used_port == address.port()) |
81 return -1; | 79 return -1; |
82 } | 80 } |
83 used_ports_->push_back(address.port()); | 81 used_ports_->push_back(address.port()); |
84 } | 82 } |
85 | 83 |
86 address_ = address; | 84 address_ = address; |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 std::unique_ptr<P2PSocketHostUdp> socket_host( | 565 std::unique_ptr<P2PSocketHostUdp> socket_host( |
568 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); | 566 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); |
569 net::IPEndPoint local_address = | 567 net::IPEndPoint local_address = |
570 ParseAddress(kTestLocalIpAddress, invalid_port); | 568 ParseAddress(kTestLocalIpAddress, invalid_port); |
571 bool rv = socket_host->Init(local_address, min_port, max_port, | 569 bool rv = socket_host->Init(local_address, min_port, max_port, |
572 P2PHostAndIPEndPoint()); | 570 P2PHostAndIPEndPoint()); |
573 EXPECT_FALSE(rv); | 571 EXPECT_FALSE(rv); |
574 } | 572 } |
575 | 573 |
576 } // namespace content | 574 } // namespace content |
OLD | NEW |