| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 int GetPeerAddress(net::IPEndPoint* address) const override { | 57 int GetPeerAddress(net::IPEndPoint* address) const override { |
| 58 NOTREACHED(); | 58 NOTREACHED(); |
| 59 return net::ERR_SOCKET_NOT_CONNECTED; | 59 return net::ERR_SOCKET_NOT_CONNECTED; |
| 60 } | 60 } |
| 61 | 61 |
| 62 int GetLocalAddress(net::IPEndPoint* address) const override { | 62 int GetLocalAddress(net::IPEndPoint* address) const override { |
| 63 *address = address_; | 63 *address = address_; |
| 64 return 0; | 64 return 0; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void UseNonBlockingIO() override {} |
| 68 |
| 67 int Listen(const net::IPEndPoint& address) override { | 69 int Listen(const net::IPEndPoint& address) override { |
| 68 if (used_ports_) { | 70 if (used_ports_) { |
| 69 for (auto used_port : *used_ports_) { | 71 for (auto used_port : *used_ports_) { |
| 70 if (used_port == address.port()) | 72 if (used_port == address.port()) |
| 71 return -1; | 73 return -1; |
| 72 } | 74 } |
| 73 used_ports_->push_back(address.port()); | 75 used_ports_->push_back(address.port()); |
| 74 } | 76 } |
| 75 | 77 |
| 76 address_ = address; | 78 address_ = address; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 std::unique_ptr<P2PSocketHostUdp> socket_host( | 500 std::unique_ptr<P2PSocketHostUdp> socket_host( |
| 499 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); | 501 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); |
| 500 net::IPEndPoint local_address = | 502 net::IPEndPoint local_address = |
| 501 ParseAddress(kTestLocalIpAddress, invalid_port); | 503 ParseAddress(kTestLocalIpAddress, invalid_port); |
| 502 bool rv = socket_host->Init(local_address, min_port, max_port, | 504 bool rv = socket_host->Init(local_address, min_port, max_port, |
| 503 P2PHostAndIPEndPoint()); | 505 P2PHostAndIPEndPoint()); |
| 504 EXPECT_FALSE(rv); | 506 EXPECT_FALSE(rv); |
| 505 } | 507 } |
| 506 | 508 |
| 507 } // namespace content | 509 } // namespace content |
| OLD | NEW |