1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-24 04:01:07 +03:00

Reset congestion controller after setting factory

Summary:
Before the change, there's no good way to recreate Cubic CC instance with custom CC factory, because Cubic is created by default.

On client side this requires calling setCongestionControl() or setTransportSettings() after calling setCongestionControllerFactory(), which is normally the case.

Reviewed By: yangchi

Differential Revision: D26401996

fbshipit-source-id: dfda39be835c67b9db42f726b3ac64c7b3d37c2f
This commit is contained in:
Andrii Vasylevskyi
2021-02-19 17:53:31 -08:00
committed by Facebook GitHub Bot
parent 1303281a51
commit 10a6feed49
7 changed files with 71 additions and 25 deletions

View File

@@ -11,6 +11,7 @@
#include <folly/io/async/AsyncSocketException.h>
#include <quic/client/handshake/CachedServerTransportParameters.h>
#include <quic/common/TimeUtil.h>
#include <quic/congestion_control/CongestionControllerFactory.h>
#include <quic/congestion_control/QuicCubic.h>
#include <quic/flowcontrol/QuicFlowController.h>
#include <quic/handshake/TransportParameters.h>
@@ -56,6 +57,16 @@ std::unique_ptr<QuicClientConnectionState> undoAllClientStateForRetry(
std::move(conn->earlyDataAppParamsValidator);
newConn->earlyDataAppParamsGetter = std::move(conn->earlyDataAppParamsGetter);
newConn->happyEyeballsState = std::move(conn->happyEyeballsState);
if (conn->congestionControllerFactory) {
newConn->congestionControllerFactory = conn->congestionControllerFactory;
if (conn->congestionController) {
// we have to recreate congestion controler
// because it holds referencs to the old state
newConn->congestionController =
newConn->congestionControllerFactory->makeCongestionController(
*newConn, conn->congestionController->type());
}
}
return newConn;
}