mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-10 21:22:20 +03:00
Introduce new connection rate limits.
Summary: This introduces a rate limit to new connections created by a worker. Right now it will simply send a VN, but eventually this will only issue a RETRY for unverified initials. Reviewed By: udippant Differential Revision: D21614905 fbshipit-source-id: 1832fbdad525c53fb1cb810aa9d7bae868c267d6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
99e5aedc21
commit
30bff94e85
@@ -15,6 +15,7 @@
|
||||
#include <quic/server/QuicReusePortUDPSocketFactory.h>
|
||||
#include <quic/server/QuicServerTransport.h>
|
||||
#include <quic/server/QuicSharedUDPSocketFactory.h>
|
||||
#include <quic/server/SlidingWindowRateLimiter.h>
|
||||
|
||||
namespace quic {
|
||||
|
||||
@@ -60,6 +61,10 @@ void QuicServer::setCongestionControllerFactory(
|
||||
ccFactory_ = std::move(ccFactory);
|
||||
}
|
||||
|
||||
void QuicServer::setRateLimit(uint64_t count, std::chrono::seconds window) {
|
||||
rateLimit_ = folly::make_optional<RateLimit>(count, window);
|
||||
}
|
||||
|
||||
void QuicServer::setSupportedVersion(const std::vector<QuicVersion>& versions) {
|
||||
supportedVersions_ = versions;
|
||||
}
|
||||
@@ -164,6 +169,10 @@ void QuicServer::initializeWorkers(
|
||||
}
|
||||
worker->setConnectionIdAlgo(connIdAlgoFactory_->make());
|
||||
worker->setCongestionControllerFactory(ccFactory_);
|
||||
if (rateLimit_) {
|
||||
worker->setRateLimiter(std::make_unique<SlidingWindowRateLimiter>(
|
||||
rateLimit_->count, rateLimit_->window));
|
||||
}
|
||||
worker->setWorkerId(i);
|
||||
worker->setTransportSettingsOverrideFn(transportSettingsOverrideFn_);
|
||||
workers_.push_back(std::move(worker));
|
||||
|
||||
Reference in New Issue
Block a user