Skip to content

Add FastNetworkManager & cleanup - #174

Open
kalibrieren wants to merge 31 commits into
Wind-Development:masterfrom
Falchus:add-fastnetworkmanager
Open

kalibrieren wants to merge 31 commits into
Wind-Development:masterfrom
Falchus:add-fastnetworkmanager

Conversation

@kalibrieren

@kalibrieren kalibrieren commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
  • Add FastNetworkManager
  • Replace Tuinity flushes
  • Replace Nacho async knockback

@windcolor-dev

Copy link
Copy Markdown
Member

Can you elaborate on this PR?

I'm guessing this makes packet ordering a lot more consistent

@kalibrieren

Copy link
Copy Markdown
Contributor Author

Can you elaborate on this PR?

I'm guessing this makes packet ordering a lot more consistent

This is a way more robust packet queue system. We also have writePacketLazily for when we need it like for the EntityPlayer destroy packet to keep the order.

@windcolor-dev

Copy link
Copy Markdown
Member

Nice! That's a good idea

This replaces Tuinity's controlled flush patch, correct?

@kalibrieren kalibrieren changed the title Add FastNetworkManager Add FastNetworkManager & cleanup Aug 28, 2026
}
}

public void writePacketLazily(Packet<?> packet, boolean flush) {

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.

What is the point of this method with flush enabled?

If flushing, why not just use dispatchPacket in NetworkManager?


// FalchusSpigot start
public static int threadSize;
private static void threadSize() {

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.

Seems like there's a queue for each entity tracking thread, so wouldn't the thread size just be the tracking threads?

for (EntityPlayer player : MinecraftServer.getServer().getPlayerList().players) {
PlayerConnection connection = player.playerConnection;
if (connection != null) {
connection.networkManager.disableAutomaticFlush();

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.

Good that this is replaced, I took a look and the tuinity patch implementation seemed very broken.

Packet<?> packet = this.c();
if (packet == null) return; // FalchusSpigot

this.trackedPlayerMap.put(entityplayer, true); // PaperBukkit // FalchusSpigot - after null check

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.

Suggested change
this.trackedPlayerMap.put(entityplayer, true); // PaperBukkit // FalchusSpigot - after null check
this.trackedPlayerMap.put(entityplayer, true); // Paper // FalchusSpigot - after null check

Good catch moving this after

// FalchusSpigot start - async kb
// based on https://github.com/Argarian-Network/NachoSpigot/tree/async-kb-hit
if (WindSpigotConfig.asyncKnockback && (packet instanceof PacketPlayOutEntityVelocity || packet instanceof PacketPlayOutPosition)) {
fastNetworkManager.writePacketLazily(packet, true);

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.

I agree the "async kb" needed to be removed

What is the benefit of this method over dispatchPacket?

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