ZaStoGram/TMessagesProj/jni/mtproxy/MtProxyHandshakePlan.cpp
loop-uh 3f8f8f27e7 Extract mtproxy module with unified retry authority
Move MTProxy policy engine from tgnet/ to self-contained jni/mtproxy/ module. Consolidate reconnect hold computation into single MtProxyRetryAuthority owner (was split across Connection, ConnectionSocket, endpoint policy, and probe coordinator, causing hold misalignment bugs). Add MtProxyTerminalDiagnostic module with host tests for pre-I/O verdict preservation (fixes 02.07/30.06 clobber livelocks). Auto-generate phase classification (isPreIoTerminalVerdict, needsReconnectBackoff, isObservationFacadePhase, isLocalSchedulerTimeout) from single Python contract into both C++ and Java to eliminate parallel maintenance. Pass native hold (coordinator terminal hold + endpoint cooldown) via JNI to Java so reconnect timer and health store use THE clock, not re-derived ones. Optimize log flushing: batch debug lines, flush errors immediately. Add module boundary guard, host build system (MSVC), and unit tests for retry logic and terminal diagnostic derivation.
2026-07-02 18:25:13 +03:00

24 lines
1.2 KiB
C++

#include "MtProxyHandshakePlan.h"
MtProxyHandshakePlan mtProxyBuildHandshakePlan(const MtProxyAdaptivePolicy::RecipeInput &input,
const MtProxyAdaptivePolicy::RecipeCursor &cursor,
const std::string &endpointKey,
const std::string &probeKey) {
MtProxyHandshakePlan plan;
plan.cursor = cursor;
plan.recipe = MtProxyAdaptivePolicy::recipeForCursor(input, cursor);
plan.recipeId = MtProxyAdaptivePolicy::recipeId(plan.recipe);
plan.endpointKey = endpointKey;
plan.probeKey = probeKey;
plan.clientHelloSni = plan.recipe.clientHelloSni;
plan.tlsProfile = plan.recipe.effectiveTlsProfile;
plan.clientHelloFragmentation = plan.recipe.clientHelloFragmentation;
plan.serverHelloParserMode = plan.recipe.serverHelloParserMode;
plan.recordSizingMode = plan.recipe.recordSizingMode;
plan.timingMode = plan.recipe.timingMode;
plan.startupCoverMode = plan.recipe.startupCoverMode;
plan.fakeTls = input.fakeTls;
plan.greaseProbe = input.probeGrease;
plan.greaseSupported = input.greaseSupported;
return plan;
}