| 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 "net/udp/udp_server_socket.h" | 5 #include "net/udp/udp_server_socket.h" |
| 6 | 6 |
| 7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
| 8 #include "net/base/rand_callback.h" | 8 #include "net/base/rand_callback.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 UDPServerSocket::UDPServerSocket(net::NetLog* net_log, | 12 UDPServerSocket::UDPServerSocket(net::NetLog* net_log, |
| 13 const net::NetLog::Source& source) | 13 const net::NetLogSource& source) |
| 14 : socket_(DatagramSocket::DEFAULT_BIND, | 14 : socket_(DatagramSocket::DEFAULT_BIND, RandIntCallback(), net_log, source), |
| 15 RandIntCallback(), | |
| 16 net_log, | |
| 17 source), | |
| 18 allow_address_reuse_(false), | 15 allow_address_reuse_(false), |
| 19 allow_broadcast_(false) { | 16 allow_broadcast_(false) {} |
| 20 } | |
| 21 | 17 |
| 22 UDPServerSocket::~UDPServerSocket() { | 18 UDPServerSocket::~UDPServerSocket() { |
| 23 } | 19 } |
| 24 | 20 |
| 25 int UDPServerSocket::Listen(const IPEndPoint& address) { | 21 int UDPServerSocket::Listen(const IPEndPoint& address) { |
| 26 int rv = socket_.Open(address.GetFamily()); | 22 int rv = socket_.Open(address.GetFamily()); |
| 27 if (rv != OK) | 23 if (rv != OK) |
| 28 return rv; | 24 return rv; |
| 29 | 25 |
| 30 if (allow_address_reuse_) { | 26 if (allow_address_reuse_) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 socket_.DetachFromThread(); | 120 socket_.DetachFromThread(); |
| 125 } | 121 } |
| 126 | 122 |
| 127 void UDPServerSocket::UseNonBlockingIO() { | 123 void UDPServerSocket::UseNonBlockingIO() { |
| 128 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
| 129 socket_.UseNonBlockingIO(); | 125 socket_.UseNonBlockingIO(); |
| 130 #endif | 126 #endif |
| 131 } | 127 } |
| 132 | 128 |
| 133 } // namespace net | 129 } // namespace net |
| OLD | NEW |