-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite networking code to use Tokio #42
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## develop #42 +/- ##
===========================================
+ Coverage 60.54% 61.43% +0.89%
===========================================
Files 78 77 -1
Lines 9284 8975 -309
===========================================
- Hits 5621 5514 -107
+ Misses 3663 3461 -202
Continue to review full report at Codecov.
|
caelunshun
force-pushed
the
develop
branch
4 times, most recently
from
September 1, 2019 00:25
25141be
to
f79547e
Compare
5 tasks
Functionality is complete. Only thing left is to fix tests and clippy. |
cheako
pushed a commit
to cheako/feather
that referenced
this pull request
Jan 4, 2020
# Summary * Replaced the mio-based IO event loop with a Tokio task * Rewrote packet encoding/decoding code, should now be more efficient * Converted `Packet` to write to `BytesMut` instead of `ByteBuf`; `ByteBuf` removed # Motivation The current network code is a homebrew asynchronous IO event loop based on mio. Numerous issues have appeared with this implementation, and the code is quite inefficient as well (three to five HashMap lookups when data is received or sent). Tokio provides its own heavily optimized event loop, in addition to a much easier to use interface. Furthermore, it can extend the async IO capability beyond the TCP streams themselves; for example, the authentication request to the Mojang API in the initial handler can now be run asynchronously, which improves performance (somewhat). Ultimately, the decision to switch to Tokio is based on performance and stability, which both are improved through the switch. # Implications * Server packet handling code will be unaffected. * The new networking code uses async/await, which was stabilized a few weeks ago and will be released in Rust stable in early to mid November. In the meantime, compiling Feather will require Rust nightly. Fixes feather-rs#34 . Resolves feather-rs#35. Resolves feather-rs#36.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR includes a refactoring and partial rewrite of the networking code, based on
tokio
.Motivation
The current network code is a homebrew asynchronous IO event loop based on
mio
. Numerous issues have appeared with this implementation, and the code is quite inefficient as well (three to fiveHashMap
lookups when data is received or sent).Tokio provides its own heavily optimized event loop, in addition to a much easier to use interface. Furthermore, it can extend the async IO capability beyond the TCP streams themselves; for example, the authentication request to the Mojang API in the initial handler can now be run asynchronously, which improves performance (somewhat).
Ultimately, the decision to switch to Tokio is based on performance and stability, which both are improved through the switch.
Implications
async
/await
, which was stabilized a few weeks ago and will be released in Rust stable in early to mid November. In the meantime, compiling Feather will require Rust nightly.Fixes #34 .
Resolves #35.
Resolves #36.