mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 12:02:50 +08:00
fix: measure TeamSpeak latency over its protocol
This commit is contained in:
1 parent
dcc52c4530
commit
a295ff4b27
7 files changed
+167
-47
No files matched your search
@@ -13,7 +13,7 @@ import { SessionManager, type ManagedSession, type SessionTeardownReason } from
|
||||
import { parseClientCommand, type ClientCommand } from "./voice-protocol.js";
|
||||
import { isRecoverable, reconnectDelayMs, reconnectWindowOpen } from "./reconnect-policy.js";
|
||||
import { WebRtcAudioSession, type WebRtcAudioOptions, type WebRtcAudioStats, type WebRtcSessionDescription } from "./webrtc-audio.js";
|
||||
import { pingTeamSpeakPort } from "./network-probe.js";
|
||||
import { pingTeamSpeakSession } from "./network-probe.js";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { OpusEncoder } = require("@discordjs/opus") as {
|
||||
@@ -873,7 +873,9 @@ async function handleCommand(
|
||||
const now = Date.now();
|
||||
if (now - entry.lastLatencyProbeAt < 150) return;
|
||||
entry.lastLatencyProbeAt = now;
|
||||
const result = await pingTeamSpeakPort(entry.target);
|
||||
const result = await pingTeamSpeakSession(
|
||||
(request, timeoutMs) => entry.tsClient.execCommandWithResponse(request, timeoutMs),
|
||||
);
|
||||
sendJson({
|
||||
type: "latencyPong",
|
||||
sequence,
|
||||
|
||||
Reference in new issue
Block a user