Commit cf00ac58 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook Github Bot

Disable GSO if FOLLY_HAVE_MSG_ERRQUEUE is not defined

Summary: Disable GSO if FOLLY_HAVE_MSG_ERRQUEUE is not defined

Reviewed By: yfeldblum

Differential Revision: D9128837

fbshipit-source-id: 25977eb7f46ac57dca17c7956277f9f647357baa
parent 0e2c4290
......@@ -499,16 +499,22 @@ bool AsyncUDPSocket::updateRegistration() noexcept {
}
bool AsyncUDPSocket::setGSO(int val) {
#ifdef FOLLY_HAVE_MSG_ERRQUEUE
int ret = ::setsockopt(fd_, SOL_UDP, UDP_SEGMENT, &val, sizeof(val));
gso_ = ret ? -1 : val;
return !ret;
#else
(void)val;
return false;
#endif
}
int AsyncUDPSocket::getGSO() {
// check if we can return the cached value
if (FOLLY_UNLIKELY(!gso_.hasValue())) {
#ifdef FOLLY_HAVE_MSG_ERRQUEUE
int gso = -1;
socklen_t optlen = sizeof(gso);
if (!::getsockopt(fd_, SOL_UDP, UDP_SEGMENT, &gso, &optlen)) {
......@@ -516,6 +522,9 @@ int AsyncUDPSocket::getGSO() {
} else {
gso_ = -1;
}
#else
gso_ = -1;
#endif
}
return gso_.value();
......
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