| 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" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 reinterpret_cast<char*>(&actual_size), &option_size); | 531 reinterpret_cast<char*>(&actual_size), &option_size); |
| 532 if (rv != 0) | 532 if (rv != 0) |
| 533 return MapSystemError(WSAGetLastError()); | 533 return MapSystemError(WSAGetLastError()); |
| 534 if (actual_size >= size) | 534 if (actual_size >= size) |
| 535 return OK; | 535 return OK; |
| 536 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SocketUnchangeableSendBuffer", | 536 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SocketUnchangeableSendBuffer", |
| 537 actual_size, 1000, 1000000, 50); | 537 actual_size, 1000, 1000000, 50); |
| 538 return ERR_SOCKET_SEND_BUFFER_SIZE_UNCHANGEABLE; | 538 return ERR_SOCKET_SEND_BUFFER_SIZE_UNCHANGEABLE; |
| 539 } | 539 } |
| 540 | 540 |
| 541 int UDPSocketWin::SetDoNotFragment() { |
| 542 DCHECK_NE(socket_, INVALID_SOCKET); |
| 543 DCHECK(CalledOnValidThread()); |
| 544 |
| 545 if (addr_family_ == AF_INET6) |
| 546 return OK; |
| 547 |
| 548 DWORD val = 1; |
| 549 int rv = setsockopt(socket_, IPPROTO_IP, IP_DONTFRAGMENT, |
| 550 reinterpret_cast<const char*>(&val), sizeof(val)); |
| 551 return rv == 0 ? OK : MapSystemError(WSAGetLastError()); |
| 552 } |
| 553 |
| 541 int UDPSocketWin::AllowAddressReuse() { | 554 int UDPSocketWin::AllowAddressReuse() { |
| 542 DCHECK_NE(socket_, INVALID_SOCKET); | 555 DCHECK_NE(socket_, INVALID_SOCKET); |
| 543 DCHECK(CalledOnValidThread()); | 556 DCHECK(CalledOnValidThread()); |
| 544 DCHECK(!is_connected()); | 557 DCHECK(!is_connected()); |
| 545 | 558 |
| 546 BOOL true_value = TRUE; | 559 BOOL true_value = TRUE; |
| 547 int rv = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, | 560 int rv = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, |
| 548 reinterpret_cast<const char*>(&true_value), | 561 reinterpret_cast<const char*>(&true_value), |
| 549 sizeof(true_value)); | 562 sizeof(true_value)); |
| 550 return rv == 0 ? OK : MapSystemError(WSAGetLastError()); | 563 return rv == 0 ? OK : MapSystemError(WSAGetLastError()); |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 void UDPSocketWin::DetachFromThread() { | 1188 void UDPSocketWin::DetachFromThread() { |
| 1176 base::NonThreadSafe::DetachFromThread(); | 1189 base::NonThreadSafe::DetachFromThread(); |
| 1177 } | 1190 } |
| 1178 | 1191 |
| 1179 void UDPSocketWin::UseNonBlockingIO() { | 1192 void UDPSocketWin::UseNonBlockingIO() { |
| 1180 DCHECK(!core_); | 1193 DCHECK(!core_); |
| 1181 use_non_blocking_io_ = true; | 1194 use_non_blocking_io_ = true; |
| 1182 } | 1195 } |
| 1183 | 1196 |
| 1184 } // namespace net | 1197 } // namespace net |
| OLD | NEW |