Commit 4d8408a7 authored by Amol Bhave's avatar Amol Bhave Committed by Facebook Github Bot

Add setTrafficClass method to AsycnUDPSocket

Summary: This field sets the IPV6_TCLASS attribute for the socket.

Reviewed By: yfeldblum

Differential Revision: D15240838

fbshipit-source-id: 81a14ee0a85010926b973c221184a82412975108
parent 8cc6a2f2
......@@ -647,6 +647,14 @@ int AsyncUDPSocket::getGSO() {
return gso_.value();
}
void AsyncUDPSocket::setTrafficClass(int tclass) {
if (netops::setsockopt(
fd_, IPPROTO_IPV6, IPV6_TCLASS, &tclass, sizeof(int)) != 0) {
throw AsyncSocketException(
AsyncSocketException::NOT_OPEN, "Failed to set IPV6_TCLASS", errno);
}
}
void AsyncUDPSocket::detachEventBase() {
DCHECK(eventBase_ && eventBase_->isInEventBaseThread());
registerHandler(uint16_t(NONE));
......
......@@ -291,6 +291,8 @@ class AsyncUDPSocket : public EventHandler {
bool setGSO(int val);
void setTrafficClass(int tclass);
protected:
virtual ssize_t
sendmsg(NetworkSocket socket, const struct msghdr* message, int flags) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment