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.
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
/*
|
|
* This is the source code of tgnet library v. 1.1
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
*
|
|
* Copyright Nikolai Kudashov, 2015-2018.
|
|
*/
|
|
|
|
#ifndef PROXYCHECKINFO_H
|
|
#define PROXYCHECKINFO_H
|
|
|
|
#include <stdint.h>
|
|
#include <sstream>
|
|
#include "Defines.h"
|
|
#include "mtproxy/MtProxyOptions.h"
|
|
|
|
#ifdef ANDROID
|
|
#include <jni.h>
|
|
#endif
|
|
|
|
enum class ProxyCheckState : uint8_t {
|
|
Queued,
|
|
Connecting,
|
|
PingSent,
|
|
Finished,
|
|
};
|
|
|
|
class ProxyCheckInfo {
|
|
|
|
public:
|
|
~ProxyCheckInfo();
|
|
|
|
ProxyCheckState state = ProxyCheckState::Queued;
|
|
int32_t connectionNum = 0;
|
|
int32_t requestToken = 0;
|
|
uint32_t connectionToken = 0;
|
|
int64_t startedAtMillis = 0;
|
|
bool finished = false;
|
|
std::string address;
|
|
uint16_t port = 1080;
|
|
std::string username;
|
|
std::string password;
|
|
std::string secret;
|
|
MtProxyOptions mtProxyOptions;
|
|
int64_t pingId = 0;
|
|
onRequestTimeFunc onRequestTime;
|
|
int32_t instanceNum = 0;
|
|
|
|
#ifdef ANDROID
|
|
jobject ptr1 = nullptr;
|
|
#endif
|
|
};
|
|
|
|
|
|
#endif
|