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

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

Issue 22381012: Allow p2p UDP packages to set DSCP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix Created 7 years, 4 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 | Annotate | Revision Log
« net/udp/udp_socket_win.h ('K') | « 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/logging.h" 10 #include "base/logging.h"
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 if (is_connected()) 745 if (is_connected())
746 return ERR_SOCKET_IS_CONNECTED; 746 return ERR_SOCKET_IS_CONNECTED;
747 747
748 if (loopback) 748 if (loopback)
749 socket_options_ |= SOCKET_OPTION_MULTICAST_LOOP; 749 socket_options_ |= SOCKET_OPTION_MULTICAST_LOOP;
750 else 750 else
751 socket_options_ &= ~SOCKET_OPTION_MULTICAST_LOOP; 751 socket_options_ &= ~SOCKET_OPTION_MULTICAST_LOOP;
752 return OK; 752 return OK;
753 } 753 }
754 754
755 int UDPSocketLibevent::SetTos(DiffServCodePoint dscp) {
756 if (dscp == DSCP_NO_CHANGE) {
757 return OK;
758 }
759 int rv;
760 DWORD dscp_and_ecn = dscp << 2;
761 if (addr_family_ == AF_INET) {
762 rv = setsockopt(socket_, IPPROTO_IP, IP_TOS,
763 reinterpret_cast<const char*>(&dscp_and_ecn),
764 sizeof(dscp_and_ecn));
765 } else {
766 rv = setsockopt(socket_, IPPROTO_IPV6, IPV6_TCLASS,
767 reinterpret_cast<const char*>(&dscp_and_ecn),
768 sizeof(dscp_and_ecn));
769 }
770 if (rv < 0)
771 return MapSystemError(errno);
772
773 return OK;
774 }
775
776
755 } // namespace net 777 } // namespace net
OLDNEW
« net/udp/udp_socket_win.h ('K') | « net/udp/udp_socket_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698