| 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 "chrome/browser/extensions/api/dial/dial_service.h" | 5 #include "chrome/browser/extensions/api/dial/dial_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 net::NetLog::Source net_log_source) { | 166 net::NetLog::Source net_log_source) { |
| 167 DCHECK(thread_checker_.CalledOnValidThread()); | 167 DCHECK(thread_checker_.CalledOnValidThread()); |
| 168 DCHECK(!socket_.get()); | 168 DCHECK(!socket_.get()); |
| 169 DCHECK(bind_ip_address.size() == net::kIPv4AddressSize); | 169 DCHECK(bind_ip_address.size() == net::kIPv4AddressSize); |
| 170 | 170 |
| 171 net::RandIntCallback rand_cb = base::Bind(&base::RandInt); | 171 net::RandIntCallback rand_cb = base::Bind(&base::RandInt); |
| 172 socket_.reset(new UDPSocket(net::DatagramSocket::RANDOM_BIND, | 172 socket_.reset(new UDPSocket(net::DatagramSocket::RANDOM_BIND, |
| 173 rand_cb, | 173 rand_cb, |
| 174 net_log, | 174 net_log, |
| 175 net_log_source)); | 175 net_log_source)); |
| 176 socket_->AllowBroadcast(); | 176 socket_->SetBroadcast(true); |
| 177 | 177 |
| 178 // 0 means bind a random port | 178 // 0 means bind a random port |
| 179 IPEndPoint address(bind_ip_address, 0); | 179 IPEndPoint address(bind_ip_address, 0); |
| 180 | 180 |
| 181 if (!CheckResult("Bind", socket_->Bind(address))) | 181 if (!CheckResult("Bind", socket_->Bind(address))) |
| 182 return false; | 182 return false; |
| 183 | 183 |
| 184 DCHECK(socket_.get()); | 184 DCHECK(socket_.get()); |
| 185 | 185 |
| 186 recv_buffer_ = new IOBufferWithSize(kDialRecvBufferSize); | 186 recv_buffer_ = new IOBufferWithSize(kDialRecvBufferSize); |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 for (ScopedVector<DialSocket>::const_iterator iter = dial_sockets_.begin(); | 615 for (ScopedVector<DialSocket>::const_iterator iter = dial_sockets_.begin(); |
| 616 iter != dial_sockets_.end(); | 616 iter != dial_sockets_.end(); |
| 617 ++iter) { | 617 ++iter) { |
| 618 if (!((*iter)->IsClosed())) | 618 if (!((*iter)->IsClosed())) |
| 619 return true; | 619 return true; |
| 620 } | 620 } |
| 621 return false; | 621 return false; |
| 622 } | 622 } |
| 623 | 623 |
| 624 } // namespace extensions | 624 } // namespace extensions |
| OLD | NEW |