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.
27 lines
955 B
C
27 lines
955 B
C
// Host-build stub for Tools/build_mtproxy_host.py (no BoringSSL on host).
|
|
// Signatures mirror BoringSSL.
|
|
//
|
|
// RAND_bytes fills the buffer from a deterministic xorshift32 stream — NOT
|
|
// random, but reproducible across test runs. It must not leave the buffer
|
|
// zeroed: the rejection-sampling helpers (endpointSecureRandomBounded /
|
|
// mtProxySecureRandomBounded) spin forever on an all-zero source when the
|
|
// bound is not a power of two. Tests therefore assert jitter ENVELOPES
|
|
// (base <= delay <= base + limit), never exact jittered values.
|
|
#ifndef MTPROXY_HOST_STUB_OPENSSL_RAND_H
|
|
#define MTPROXY_HOST_STUB_OPENSSL_RAND_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
inline int RAND_bytes(uint8_t *buf, size_t len) {
|
|
static uint32_t state = 0x12345678u;
|
|
for (size_t i = 0; i < len; i++) {
|
|
state ^= state << 13;
|
|
state ^= state >> 17;
|
|
state ^= state << 5;
|
|
buf[i] = (uint8_t) state;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
#endif
|