| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |