* Move packets to proper packages & implement game thread metadata for every packet
* Add new ticking info for 1.21.3
Notable info:
ServerboundSelectBundleItemPacket is not ticked, it's instant
ClientboundSetHeldSlotPacket is already ticked as it is just renamed ClientboundSetCarriedItemPacket
* Expose packet handler executor
* Do not tick delimiter packet
* Allow server to define packet handler executor factory
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/packet/Packet.java
Co-authored-by: chris <github@onechris.mozmail.com>
---------
Co-authored-by: chris <github@onechris.mozmail.com>
* Move reusable methods to a separate helper class
This way we allow other apps such as Geyser LocalSession to use these currently private methods without needing to copy over the code.
* Remove unused field
* Initial code changes
* Make it compile
* Small inlining
* Make less detectable by anticheats and fix keepalive during configuration
* Fix keepalive edge case
* Properly switch inbound protocol in server listener
* Add flow control
* Make toggling automatic keepalive work in another way
* Remove ping pong packets again
* Address review
* Handle keepalive in configuration
* Only spawn keepalive after login is acknowledged
* Prevent very unlikely race conditions with keepalive being switched during a task
* Add debug log for packet serialization and state switching
* Add one more debug print
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/Session.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/protocol/MinecraftProtocol.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/protocol/MinecraftProtocol.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Mark packet as nonnull
* Fix outbound writing race conditions
* Ensure packets are always sent on the event loop
This replicates the same approach Mojang uses in their networking code.
* Reduce log verbosity
* Put errors into debug
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpClientSession.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Add comment to always running in event loop
* Handle auto read earlier to prevent race conditions
* Make instance dynamic
* Revert "Make instance dynamic"
This reverts commit 7f8affbdc5.
* Make flush packet priority
* Do not hide original line that is the cause of the exception
* Cancel packet using exception rather than return
* Properly iterate through parents
* Set log level to debug for unit tests
* Revert "Properly iterate through parents"
This reverts commit 4e2b64d983.
* Revert "Cancel packet using exception rather than return"
This reverts commit 6507e77bbe.
* Add write length filter
* Reuse bytebuf for fake flush to avoid unnecessary allocations
* Make tests happy
* Remake dropping packets
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Fix space
* Rename to flush packet
* Add mojmap reference
* Share keepalive code
* Fix compilation
* Revert a tiny bit closer to vanilla
* Inline lambda
* Inherit annotation
* Inherit annotation 2
* Use checkerframework annotation
* Fixup grammar slightly
* Add reset states method
* Add log marker for packet logging
---------
Co-authored-by: chris <github@onechris.mozmail.com>
* Improve pipeline
This simplifies all pipeline code and ensures some listeners like the sizer are always present. The code already assumed that the sizer is always there and thus causes issues. The sizer can be deactivated still now and has pretty much no performance losses from this. The profit from this PR is that there is less logic with modifying the PR and thus developers interacting with the channel can assume specific things about the order and placements of elements in the pipeline. This will be useful once ViaVersion is supported, and it is expected that certain elements always are in the pipeline and don't change. My plan is to also always have an encryption and compression handler in the pipeline that is controlled via AttributeKeys from netty, but for that first #828 needs to be merged. So this PR only completes the goal partially, but that's fine. PR is ready for review like it is right now.
* Revert some stuff
* Fix channel race condition
* Fix closing race condition
* Prevent client race conditions.
* Fix test failure, idk how, idk why, but it works now
* Address review
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java
Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java
Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/BuiltinFlags.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java
Co-authored-by: chris <github@onechris.mozmail.com>
* Update protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpServer.java
Co-authored-by: chris <github@onechris.mozmail.com>
---------
Co-authored-by: Konicai <71294714+Konicai@users.noreply.github.com>
Co-authored-by: chris <github@onechris.mozmail.com>