mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-10 21:22:20 +03:00
Summary: SO_REUSEADDR for UDP has few corner cases (see https://www.spinics.net/lists/netdev/msg206437.html) There's no reason to enable this by default Reviewed By: siyengar, lnicco Differential Revision: D17401298 fbshipit-source-id: 2dc88052e8df52841162107e4f0ee87cb3536517
29 lines
691 B
C++
29 lines
691 B
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <quic/server/QuicUDPSocketFactory.h>
|
|
|
|
namespace quic {
|
|
|
|
class QuicReusePortUDPSocketFactory : public QuicUDPSocketFactory {
|
|
public:
|
|
~QuicReusePortUDPSocketFactory() override {}
|
|
QuicReusePortUDPSocketFactory() {}
|
|
|
|
std::unique_ptr<folly::AsyncUDPSocket> make(folly::EventBase* evb, int)
|
|
override {
|
|
auto sock = std::make_unique<folly::AsyncUDPSocket>(evb);
|
|
sock->setReusePort(true);
|
|
sock->setReuseAddr(false);
|
|
return sock;
|
|
}
|
|
};
|
|
} // namespace quic
|