1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00

Move CryptoFactory from SrverHandshake to FizzServerHandshake (#162)

Summary:
This is moving some fizz specific part of the server handshake in FizzServerHandshake, following a similar pattern as what was done for the client.

Depends on https://github.com/facebookincubator/mvfst/issues/161 and https://github.com/facebookincubator/mvfst/issues/160

Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/162

Reviewed By: yangchi

Differential Revision: D23560890

Pulled By: xttjsn

fbshipit-source-id: 7bc03f6726ed2e922838d0b8dcd6b5d99fe9c540
This commit is contained in:
Amaury Séchet
2020-09-11 15:09:57 -07:00
committed by Facebook GitHub Bot
parent 80c0b3185a
commit 689cdcc943
5 changed files with 61 additions and 26 deletions

View File

@@ -19,6 +19,8 @@
#include <quic/common/test/TestUtils.h>
#include <quic/congestion_control/ServerCongestionControllerFactory.h>
#include <quic/fizz/handshake/FizzCryptoFactory.h>
#include <quic/fizz/server/handshake/FizzServerHandshake.h>
#include <quic/fizz/server/handshake/FizzServerQuicHandshakeContext.h>
#include <quic/logging/FileQLogger.h>
#include <quic/server/handshake/ServerHandshake.h>
#include <quic/server/test/Mocks.h>
@@ -38,14 +40,15 @@ using ByteEvent = QuicTransportBase::ByteEvent;
using PacketDropReason = QuicTransportStatsCallback::PacketDropReason;
} // namespace
class FakeServerHandshake : public ServerHandshake {
class FakeServerHandshake : public FizzServerHandshake {
public:
explicit FakeServerHandshake(
QuicServerConnectionState& conn,
std::shared_ptr<FizzServerQuicHandshakeContext> fizzContext,
bool chloSync = false,
bool cfinSync = false,
folly::Optional<uint64_t> clientActiveConnectionIdLimit = folly::none)
: ServerHandshake(&conn),
: FizzServerHandshake(&conn, std::move(fizzContext)),
conn_(conn),
chloSync_(chloSync),
cfinSync_(cfinSync),
@@ -341,7 +344,9 @@ class QuicServerTransportTest : public Test {
}
virtual void initializeServerHandshake() {
fakeHandshake = new FakeServerHandshake(server->getNonConstConn());
fakeHandshake = new FakeServerHandshake(
server->getNonConstConn(),
std::make_shared<FizzServerQuicHandshakeContext>());
}
virtual bool getDisableMigration() {
@@ -2195,6 +2200,7 @@ class QuicServerTransportAllowMigrationTest
virtual void initializeServerHandshake() override {
fakeHandshake = new FakeServerHandshake(
server->getNonConstConn(),
std::make_shared<FizzServerQuicHandshakeContext>(),
false,
false,
GetParam().clientSentActiveConnIdTransportParam);
@@ -3914,7 +3920,10 @@ class QuicServerTransportPendingDataTest
void initializeServerHandshake() override {
fakeHandshake = new FakeServerHandshake(
server->getNonConstConn(), GetParam().chloSync, GetParam().cfinSync);
server->getNonConstConn(),
std::make_shared<FizzServerQuicHandshakeContext>(),
GetParam().chloSync,
GetParam().cfinSync);
if (GetParam().acceptZeroRtt) {
fakeHandshake->allowZeroRttKeys();
}
@@ -4081,7 +4090,10 @@ class QuicServerTransportHandshakeTest
void initializeServerHandshake() override {
fakeHandshake = new FakeServerHandshake(
server->getNonConstConn(), GetParam().chloSync, GetParam().cfinSync);
server->getNonConstConn(),
std::make_shared<FizzServerQuicHandshakeContext>(),
GetParam().chloSync,
GetParam().cfinSync);
if (GetParam().acceptZeroRtt) {
fakeHandshake->allowZeroRttKeys();
}