fix(tunnel): Fixes the delayed display logic to correctly handle microsecond-level delays.

- Adjust the delayed formatting function to prioritize checking if the delay is 0 to avoid displaying errors.
- When the delay is less than 1 millisecond, it is displayed in microseconds to improve the precision of the expression.
feat (constants): Shorten heart rate intervals and timeouts to improve response speed.
- Adjust HeartbeatInterval from 5 seconds to 2 seconds
- Adjust HeartbeatTimeout from 15 seconds to 6 seconds
- Improve the sensitivity of heartbeat detection between the client and the server
This commit is contained in:
Gouryella
2025-12-10 16:25:45 +08:00
parent f6f2c6fd5b
commit b3c8fc3f41
2 changed files with 11 additions and 6 deletions

View File

@@ -10,10 +10,10 @@ const (
DefaultWSPort = 8080
// HeartbeatInterval is how often clients send heartbeat messages
HeartbeatInterval = 5 * time.Second
HeartbeatInterval = 2 * time.Second
// HeartbeatTimeout is how long the server waits before considering a connection dead
HeartbeatTimeout = 15 * time.Second
HeartbeatTimeout = 6 * time.Second
// RequestTimeout is the maximum time to wait for a response from the client
RequestTimeout = 30 * time.Second