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

Unified 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: fixed tests 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 side-by-side diff with in-line comments
Download patch
Index: net/udp/udp_socket_win.cc
diff --git a/net/udp/udp_socket_win.cc b/net/udp/udp_socket_win.cc
index 1f0c337fd4a609fcb783bb0382345a88ab4ecd34..3f3e13b93a2c58186f408538927f96704456dfdf 100644
--- a/net/udp/udp_socket_win.cc
+++ b/net/udp/udp_socket_win.cc
@@ -166,6 +166,7 @@ UDPSocketWin::UDPSocketWin(DatagramSocket::BindType bind_type,
addr_family_(0),
socket_options_(SOCKET_OPTION_MULTICAST_LOOP),
multicast_time_to_live_(1),
+ dscp_(DSCP_CS0),
bind_type_(bind_type),
rand_int_cb_(rand_int_cb),
recv_from_address_(NULL),
@@ -621,6 +622,22 @@ int UDPSocketWin::SetSocketOptions() {
if (rv < 0)
return MapSystemError(WSAGetLastError());
}
+ if (dscp_) {
+ int rw;
+ DWORD dscp_and_ecn = dscp_ << 2;
+ if (addr_family_ == AF_INET) {
+ rv = setsockopt(socket_, IPPROTO_IP, IP_TOS,
+ reinterpret_cast<const char*>(&dscp_and_ecn),
+ sizeof(dscp_and_ecn));
+ } else {
+ rv = setsockopt(socket_, IPPROTO_IPV6, IPV6_TCLASS,
+ reinterpret_cast<const char*>(&dscp_and_ecn),
+ sizeof(dscp_and_ecn));
+ }
+ if (rv < 0) {
+ LOG(INFO) << "Failed to set dscp, errno=" << errno;
+ }
+ }
return OK;
}
« content/browser/renderer_host/p2p/socket_host_udp.cc ('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