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_socket_win.h" | 5 #include "net/udp/udp_socket_win.h" |
6 | 6 |
7 #include <mstcpip.h> | 7 #include <mstcpip.h> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
15 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
18 #include "net/base/ip_address.h" | 18 #include "net/base/ip_address.h" |
19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
21 #include "net/base/network_activity_monitor.h" | 21 #include "net/base/network_activity_monitor.h" |
22 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
23 #include "net/base/sockaddr_storage.h" | 23 #include "net/base/sockaddr_storage.h" |
24 #include "net/base/winsock_init.h" | 24 #include "net/base/winsock_init.h" |
25 #include "net/base/winsock_util.h" | 25 #include "net/base/winsock_util.h" |
26 #include "net/log/net_log.h" | 26 #include "net/log/net_log.h" |
27 #include "net/log/net_log_event_type.h" | 27 #include "net/log/net_log_event_type.h" |
| 28 #include "net/log/net_log_source.h" |
28 #include "net/log/net_log_source_type.h" | 29 #include "net/log/net_log_source_type.h" |
29 #include "net/socket/socket_descriptor.h" | 30 #include "net/socket/socket_descriptor.h" |
30 #include "net/udp/udp_net_log_parameters.h" | 31 #include "net/udp/udp_net_log_parameters.h" |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 const int kBindRetries = 10; | 35 const int kBindRetries = 10; |
35 const int kPortStart = 1024; | 36 const int kPortStart = 1024; |
36 const int kPortEnd = 65535; | 37 const int kPortEnd = 65535; |
37 | 38 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 reserved, | 238 reserved, |
238 overlapped); | 239 overlapped); |
239 } | 240 } |
240 | 241 |
241 | 242 |
242 //----------------------------------------------------------------------------- | 243 //----------------------------------------------------------------------------- |
243 | 244 |
244 UDPSocketWin::UDPSocketWin(DatagramSocket::BindType bind_type, | 245 UDPSocketWin::UDPSocketWin(DatagramSocket::BindType bind_type, |
245 const RandIntCallback& rand_int_cb, | 246 const RandIntCallback& rand_int_cb, |
246 net::NetLog* net_log, | 247 net::NetLog* net_log, |
247 const net::NetLog::Source& source) | 248 const net::NetLogSource& source) |
248 : socket_(INVALID_SOCKET), | 249 : socket_(INVALID_SOCKET), |
249 addr_family_(0), | 250 addr_family_(0), |
250 is_connected_(false), | 251 is_connected_(false), |
251 socket_options_(SOCKET_OPTION_MULTICAST_LOOP), | 252 socket_options_(SOCKET_OPTION_MULTICAST_LOOP), |
252 multicast_interface_(0), | 253 multicast_interface_(0), |
253 multicast_time_to_live_(1), | 254 multicast_time_to_live_(1), |
254 bind_type_(bind_type), | 255 bind_type_(bind_type), |
255 rand_int_cb_(rand_int_cb), | 256 rand_int_cb_(rand_int_cb), |
256 use_non_blocking_io_(false), | 257 use_non_blocking_io_(false), |
257 read_iobuffer_len_(0), | 258 read_iobuffer_len_(0), |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 void UDPSocketWin::DetachFromThread() { | 1192 void UDPSocketWin::DetachFromThread() { |
1192 base::NonThreadSafe::DetachFromThread(); | 1193 base::NonThreadSafe::DetachFromThread(); |
1193 } | 1194 } |
1194 | 1195 |
1195 void UDPSocketWin::UseNonBlockingIO() { | 1196 void UDPSocketWin::UseNonBlockingIO() { |
1196 DCHECK(!core_); | 1197 DCHECK(!core_); |
1197 use_non_blocking_io_ = true; | 1198 use_non_blocking_io_ = true; |
1198 } | 1199 } |
1199 | 1200 |
1200 } // namespace net | 1201 } // namespace net |
OLD | NEW |