Extract MTProxy endpoint recording logic into MtProxyEndpointRecorder and MtProxyProbeLease helper classes, and introduce EmojiPanelAnimationScheduler for controlled animation playback in emoji panels. Key changes: - Move endpoint failure/handshake/data-path recording from ConnectionSocket to MtProxyEndpointRecorder - Replace probe lease management methods with MtProxyProbeLease member class - Add EmojiPanelAnimationScheduler to manage GIF/sticker playback based on visibility and scroll state - Add animation FPS limiting and invalidation delegate hooks to ImageReceiver - Update Java proxy event handling to route connected/connect_start/usable_success through ProxyEventReducer - Update verification tools to reflect new architecture
42 lines
1.8 KiB
C++
42 lines
1.8 KiB
C++
#include "MtProxySocketPublisher.h"
|
|
|
|
MtProxySocketObservation mtProxyNormalizeSocketObservation(const MtProxySocketObservation &observation) {
|
|
MtProxySocketObservation normalized = observation;
|
|
if (normalized.phase == nullptr || normalized.phase[0] == '\0') {
|
|
normalized.phase = MtProxyPhase::ConnectionNotStarted;
|
|
}
|
|
if (normalized.reason == nullptr || normalized.reason[0] == '\0') {
|
|
normalized.reason = "unknown";
|
|
}
|
|
return normalized;
|
|
}
|
|
|
|
void mtProxyPublishSocketObservation(const MtProxySocketObservation &observation, const MtProxySocketPublisherCallbacks &callbacks) {
|
|
MtProxySocketObservation normalized = mtProxyNormalizeSocketObservation(observation);
|
|
if (normalized.publishVisibleStage && callbacks.publishVisibleStage) {
|
|
callbacks.publishVisibleStage(normalized);
|
|
}
|
|
if (normalized.recordEndpointFailure && callbacks.recordEndpointFailure) {
|
|
callbacks.recordEndpointFailure(normalized);
|
|
}
|
|
}
|
|
|
|
void mtProxyPublishSocketObservation(const MtProxySocketObservation &observation, const MtProxySocketPublisherContext &context, const MtProxySocketPublisherCallbacks &callbacks) {
|
|
MtProxySocketObservation enriched = observation;
|
|
if (enriched.endpointKey.empty()) {
|
|
enriched.endpointKey = context.endpointKey;
|
|
}
|
|
if (enriched.probeKey.empty()) {
|
|
enriched.probeKey = context.probeKey;
|
|
}
|
|
if (enriched.networkEndpointKey.empty()) {
|
|
enriched.networkEndpointKey = context.networkEndpointKey;
|
|
}
|
|
mtProxyPublishSocketObservation(enriched, callbacks);
|
|
}
|
|
|
|
bool mtProxySocketObservationIsHighRiskPhase(const char *phase) {
|
|
// The phase set is generated from Tools/mtproxy_phase_contract.py
|
|
// (observation_facade=True) into MtProxyPhaseClassification.h.
|
|
return MtProxyPhase::isObservationFacadePhase(phase);
|
|
}
|