-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Refactor serve_packet into IO and non IO parts #1151
Conversation
This removes redundancy by moving out all serialization and IO from the match arms and only do them once.
This makes testing and reading easier.
This decouples the counters from the response generation, making for better readable code.
This reduces the methods in server, since stat counting only really needs the stats and the result and none of the other fields of Server.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1151 +/- ##
==========================================
+ Coverage 85.06% 85.25% +0.18%
==========================================
Files 57 57
Lines 15437 15506 +69
==========================================
+ Hits 13132 13219 +87
+ Misses 2305 2287 -18
☔ View full report in Codecov by Sentry. |
89312cc
to
cf5a6f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor points, but otherwise looking very good.
This ensures we can not even create a response that was longer than the original request.
This decouples the IO during packet handling from the actual logic. This allows easier writing of tests,
This PR also flattens a lot of nested matches to make them more readable.