Skip to content

client: respond to network_stack_latency packets#750

Open
VasilisDragon wants to merge 1 commit into
PrismarineJS:masterfrom
VasilisDragon:vasilis-network-stack-latency
Open

client: respond to network_stack_latency packets#750
VasilisDragon wants to merge 1 commit into
PrismarineJS:masterfrom
VasilisDragon:vasilis-network-stack-latency

Conversation

@VasilisDragon

Copy link
Copy Markdown

A vanilla client echoes network_stack_latency back to the server, but the client never did, so latency-measuring servers (and server-side anticheats that track the round-trip) see it as unresponsive and time it out. Echo each request straight back with the same timestamp.

@VasilisDragon

Copy link
Copy Markdown
Author

Oh forgot to add. Addresses the latency-transaction kick in #643

Comment thread test/networkStackLatency.test.js Outdated
@@ -0,0 +1,47 @@
/* eslint-env jest */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test is not needed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed, thanks

Comment thread src/createClient.js Outdated
// them to measure latency and to detect unresponsive clients. Echo each request straight back
// with the same timestamp so the round-trip resolves. See #643.
function respondToNetworkStackLatency (client) {
client.on('network_stack_latency', (packet) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This function isn't needed, it can be inlined

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Inlined, thanks

A vanilla client echoes network_stack_latency back to the server, but the client never did, so latency-measuring servers (and server-side anticheats that track the round-trip) see it as unresponsive and time it out. Echo each request straight back with the same timestamp.
@VasilisDragon
VasilisDragon force-pushed the vasilis-network-stack-latency branch from 509b80b to d5d20d0 Compare June 27, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants