1 /* 2 * Copyright (c) Facebook, Inc. and its affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 * 7 */ 8 9 #pragma once 10 11 #include <quic/server/QuicUDPSocketFactory.h> 12 13 namespace quic { 14 15 class QuicReusePortUDPSocketFactory : public QuicUDPSocketFactory { 16 public: ~QuicReusePortUDPSocketFactory()17 ~QuicReusePortUDPSocketFactory() override {} QuicReusePortUDPSocketFactory()18 QuicReusePortUDPSocketFactory() {} 19 make(folly::EventBase * evb,int)20 std::unique_ptr<folly::AsyncUDPSocket> make(folly::EventBase* evb, int) 21 override { 22 auto sock = std::make_unique<folly::AsyncUDPSocket>(evb); 23 sock->setReusePort(true); 24 sock->setReuseAddr(false); 25 return sock; 26 } 27 }; 28 } // namespace quic 29