mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-25 15:43:13 +03:00
Remove ServerHandshake::getContext (#167)
Summary: We can remove the reference to the context in the handshake and use `state_.context()` instead. Depends on https://github.com/facebookincubator/mvfst/issues/165 Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/167 Reviewed By: yangchi Differential Revision: D23658708 Pulled By: xttjsn fbshipit-source-id: 8cc42ea7677317b2bba562ba88d00a71a830bde0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6eb3e7837f
commit
fc5ccd14b2
@@ -32,7 +32,7 @@ void FizzServerHandshake::initializeImpl(
|
||||
context->setVersionFallbackEnabled(false);
|
||||
// Since Draft-17, client won't sent EOED
|
||||
context->setOmitEarlyRecordLayer(true);
|
||||
context_ = std::move(context);
|
||||
state_.context() = std::move(context);
|
||||
callback_ = callback;
|
||||
|
||||
if (validator) {
|
||||
@@ -51,4 +51,13 @@ const CryptoFactory& FizzServerHandshake::getCryptoFactory() const {
|
||||
return cryptoFactory_;
|
||||
}
|
||||
|
||||
void FizzServerHandshake::processAccept() {
|
||||
addProcessingActions(machine_.processAccept(
|
||||
state_, executor_, state_.context(), transportParams_));
|
||||
}
|
||||
|
||||
const fizz::server::FizzServerContext* FizzServerHandshake::getContext() const {
|
||||
return state_.context();
|
||||
}
|
||||
|
||||
} // namespace quic
|
||||
|
||||
@@ -24,6 +24,13 @@ class FizzServerHandshake : public ServerHandshake {
|
||||
|
||||
const CryptoFactory& getCryptoFactory() const override;
|
||||
|
||||
void processAccept() override;
|
||||
|
||||
/**
|
||||
* Returns the context used by the ServerHandshake.
|
||||
*/
|
||||
const fizz::server::FizzServerContext* getContext() const;
|
||||
|
||||
private:
|
||||
void initializeImpl(
|
||||
HandshakeCallback* callback,
|
||||
|
||||
@@ -23,10 +23,9 @@ void ServerHandshake::accept(
|
||||
SCOPE_EXIT {
|
||||
inHandshakeStack_ = false;
|
||||
};
|
||||
transportParams_ = transportParams;
|
||||
transportParams_ = std::move(transportParams);
|
||||
inHandshakeStack_ = true;
|
||||
addProcessingActions(machine_.processAccept(
|
||||
state_, executor_, context_, std::move(transportParams)));
|
||||
processAccept();
|
||||
}
|
||||
|
||||
void ServerHandshake::initialize(
|
||||
@@ -177,11 +176,6 @@ const fizz::server::State& ServerHandshake::getState() const {
|
||||
return state_;
|
||||
}
|
||||
|
||||
const std::shared_ptr<const fizz::server::FizzServerContext>
|
||||
ServerHandshake::getContext() const {
|
||||
return context_;
|
||||
}
|
||||
|
||||
const folly::Optional<std::string>& ServerHandshake::getApplicationProtocol()
|
||||
const {
|
||||
return state_.alpn();
|
||||
|
||||
@@ -191,12 +191,6 @@ class ServerHandshake : public Handshake {
|
||||
*/
|
||||
const fizz::server::State& getState() const;
|
||||
|
||||
/**
|
||||
* Returns the context used by the ServerHandshake.
|
||||
*/
|
||||
const std::shared_ptr<const fizz::server::FizzServerContext> getContext()
|
||||
const;
|
||||
|
||||
/**
|
||||
* Retuns the negotiated ALPN from the handshake.
|
||||
*/
|
||||
@@ -239,7 +233,6 @@ class ServerHandshake : public Handshake {
|
||||
QuicConnectionStateBase* conn_;
|
||||
folly::DelayedDestruction::DestructorGuard actionGuard_;
|
||||
folly::Executor* executor_;
|
||||
std::shared_ptr<const fizz::server::FizzServerContext> context_;
|
||||
using PendingEvent = fizz::WriteNewSessionTicket;
|
||||
std::deque<PendingEvent> pendingEvents_;
|
||||
|
||||
@@ -280,5 +273,8 @@ class ServerHandshake : public Handshake {
|
||||
std::unique_ptr<fizz::server::AppTokenValidator> validator) = 0;
|
||||
|
||||
virtual EncryptionLevel getReadRecordLayerEncryptionLevel() = 0;
|
||||
|
||||
virtual void processAccept() = 0;
|
||||
}; // namespace quic
|
||||
|
||||
} // namespace quic
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <quic/fizz/client/handshake/FizzClientExtensions.h>
|
||||
#include <quic/fizz/handshake/FizzBridge.h>
|
||||
#include <quic/fizz/handshake/QuicFizzFactory.h>
|
||||
#include <quic/fizz/server/handshake/FizzServerHandshake.h>
|
||||
#include <quic/fizz/server/handshake/FizzServerQuicHandshakeContext.h>
|
||||
#include <quic/handshake/HandshakeLayer.h>
|
||||
#include <quic/server/handshake/AppToken.h>
|
||||
@@ -836,9 +837,10 @@ TEST_F(ServerHandshakeZeroRttTest, TestResumption) {
|
||||
}
|
||||
|
||||
TEST_F(ServerHandshakeZeroRttTest, TestRejectZeroRttNotEnabled) {
|
||||
auto realServerCtx = handshake->getContext();
|
||||
auto realServerCtx =
|
||||
dynamic_cast<FizzServerHandshake*>(handshake)->getContext();
|
||||
auto nonConstServerCtx =
|
||||
const_cast<fizz::server::FizzServerContext*>(realServerCtx.get());
|
||||
const_cast<fizz::server::FizzServerContext*>(realServerCtx);
|
||||
nonConstServerCtx->setEarlyDataSettings(
|
||||
false, fizz::server::ClockSkewTolerance(), nullptr);
|
||||
EXPECT_CALL(*validator_, validate(_)).Times(0);
|
||||
|
||||
Reference in New Issue
Block a user