Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: net/udp/udp_socket_win.cc

Issue 2235973002: Add a SetDoNotFragment() method to DatagramSocket, and call this for (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/udp/udp_socket_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/udp/udp_socket_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698