Commit graph

12 commits

Author SHA1 Message Date
Ryan Johnson f4714cf255
Redesign packet processing and improve Client update procedure. (#146)
Closes #82
Closes #43
Closes #64

# Changes and Improvements
- Packet encoding/decoding happens within `Client` instead of being sent
over a channel first. This is better for performance and lays the
groundwork for #83.
- Reduce the amount of copying necessary by leveraging the `bytes` crate
and recent changes to `EncodePacket`. Performance is noticeably improved
with maximum players in the `rust-mc-bot` test going from 750 to 1050.
- Packet encoding/decoding code is decoupled from IO. This is easier to
understand and more suitable for a future protocol lib.
- Precise control over the number of bytes that are buffered for
sending/receiving. This is important for limiting maximum memory usage
correctly.
- "packet controllers" are introduced, which are convenient structures
for managing packet IO before and during the play state.
- `byte_channel` module is created to help implement the
`PlayPacketController`. This is essentially a channel of bytes
implemented with an `Arc<Mutex<BytesMut>>`.
- Error handling in the update procedure for clients was improved using
`anyhow::Result<()>` to exit as early as possible. The `client` module
is a bit cleaner as a result.
- The `LoginPlay` packet is always sent before all other play packets.
We no longer have to worry about the behavior of packets sent before
that packet. Most packet deferring performed currently can be
eliminated.
- The packet_inspector was rewritten in response to the above changes.
- Timeouts on IO operations behave better.

# Known Issues
- The packet_inspector now re-encodes packets rather than just decoding
them. This will cause problems when trying to use it with the vanilla
server because there are missing clientbound packets and other issues.
This will be fixed when the protocol module is moved to a separate
crate.
2022-11-01 03:11:51 -07:00
Ryan Johnson 71d82c5330
Add encoded_len method to Encode trait. (#125)
This allows packets to calculate their exact length up front.
This isn't currently tested or being used for anything, but that will come in later changes.
2022-10-19 01:52:02 -07:00
Ryan 9b8fbc5d82 Better "encryption enabled" message in packet_inspector 2022-10-19 01:42:32 -07:00
EmperialDev 419d317736
Migrating the packets to wiki.vg (#62)
Addresses #56. Migrating all the packet names to wiki.vg's instead of fabric's.
2022-09-16 21:29:48 -07:00
Ryan Johnson 0a75f103aa
Packet filtering (#67)
* Add `PacketName`

* Fix inefficiency in codec.rs

* Add regex argument to packet_inspector

* Reorder imports

* Make the regex arg optional

* Update README
2022-09-16 05:31:37 -07:00
Carson McManus 7c23d7a086
add docs for packet inspector: quick start w/ vanilla server in docker (#63) 2022-09-15 18:59:43 -07:00
Ryan Johnson ddc74ef01d
stderr -> stdout 2022-09-05 22:29:19 -07:00
Ryan 067d753267 Move packet_inspector README.md to correct directory 2022-09-05 22:18:13 -07:00
Ryan Johnson 9ab54cc930
Tweak packet_inspector README 2022-09-05 21:25:30 -07:00
Ryan Johnson 62f7a039cc
Create README for packet_inspector 2022-09-05 18:33:27 -07:00
Ryan ebbea74017 Prepare for public release 2022-09-03 16:48:11 -07:00
Ryan 27033c758e Update packet_inspector 2022-09-01 00:57:02 -07:00