summaryrefslogtreecommitdiffstats
path: root/net/udp/udp_socket_libevent.cc
diff options
context:
space:
mode:
authorhubbe@chromium.org <hubbe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 00:34:41 +0000
committerhubbe@chromium.org <hubbe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 00:34:41 +0000
commita8a442b37af870c13cf4d68f5e1a63b7764f2f1e (patch)
tree5ab2eca565092e6a5feb721b8c037a5866f1f577 /net/udp/udp_socket_libevent.cc
parent86ff11ca424f22a71738426abb6244cafca45e7d (diff)
downloadchromium_src-a8a442b37af870c13cf4d68f5e1a63b7764f2f1e.zip
chromium_src-a8a442b37af870c13cf4d68f5e1a63b7764f2f1e.tar.gz
chromium_src-a8a442b37af870c13cf4d68f5e1a63b7764f2f1e.tar.bz2
Implement support for p2p socket UDP packages to set the Differntiated Services Code Point for each package. Will be used by webrtc to hopefully improve performance. (See bug for how we will test this.)
BUG=277022 Review URL: https://codereview.chromium.org/22381012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229975 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/udp/udp_socket_libevent.cc')
-rw-r--r--net/udp/udp_socket_libevent.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc
index 5ed52f5..990aa57 100644
--- a/net/udp/udp_socket_libevent.cc
+++ b/net/udp/udp_socket_libevent.cc
@@ -652,4 +652,24 @@ int UDPSocketLibevent::SetMulticastLoopbackMode(bool loopback) {
socket_options_ &= ~SOCKET_OPTION_MULTICAST_LOOP;
return OK;
}
+
+int UDPSocketLibevent::SetDiffServCodePoint(DiffServCodePoint dscp) {
+ if (dscp == DSCP_NO_CHANGE) {
+ return OK;
+ }
+ int rv;
+ int dscp_and_ecn = dscp << 2;
+ if (addr_family_ == AF_INET) {
+ rv = setsockopt(socket_, IPPROTO_IP, IP_TOS,
+ &dscp_and_ecn, sizeof(dscp_and_ecn));
+ } else {
+ rv = setsockopt(socket_, IPPROTO_IPV6, IPV6_TCLASS,
+ &dscp_and_ecn, sizeof(dscp_and_ecn));
+ }
+ if (rv < 0)
+ return MapSystemError(errno);
+
+ return OK;
+}
+
} // namespace net