Skip to content

Conversation

@mibac138
Copy link

@mibac138 mibac138 commented Apr 2, 2025

The root of the issue is that the keepAliveTimer was only started once when creating the ServerPlayer and then always just Reset() which does not start it again. The timer was only ever started once and then reset while not having counted any time.

To test this remove ServerPlayingState:194 (if connection is LNL: return) and OnNetworkLatencyUpdate in NetworkingLiteNet (or just connect using Steam)

As a drive-by improvement I added some minor comments nearby.

The root of the issue is that the keepAliveTimer was only started once
when creating the ServerPlayer and then always just `Reset()` which does
not start it again. The timer was only ever started once and then reset
while not having counted any time.

To test this remove ServerPlayingState:194 (if connection is LNL: return)
and OnNetworkLatencyUpdate in NetworkingLiteNet

As a drive-by improvement I added some minor comments nearby.
Comment on lines +81 to +84
if (!keepAliveTimer.IsRunning)
{
keepAliveTimer.Start();
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, this if is redundant as starting a already running Stopwatch is a no-op (i.e. doesn't reset it) but I feel this conveys intention better (my intuition would be that this always starts the timer from 0 and doesn't just keep running with the same time if already started).

@notfood notfood added the fix Fixes for a bug or desync. label Apr 10, 2025
@notfood notfood changed the base branch from master to dev June 28, 2025 16:36
@notfood notfood merged commit 901a0c3 into rwmt:dev Jul 1, 2025
1 check passed
@mibac138 mibac138 deleted the ping-pong branch July 2, 2025 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fixes for a bug or desync.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants