-
Notifications
You must be signed in to change notification settings - Fork 32
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
Abstract I/O #204
Abstract I/O #204
Conversation
With the current implementation in order to disconnect user need to write library-specific code. For example, in case of renet user will need to call `RenetClient::disconnect` or remove `RenetClient` resource. I think we can do better by hiding `RepliconServer::set_active` and `RepliconClient::set_status` and providing events for messaging libraries and users to control it. But I will probably do it in a follow-up PR. We can include more library-independent things into `RepliconServer`, but I would also do it in a follow-up PRs.
e4b00cd
to
a50fa8f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #204 +/- ##
==========================================
+ Coverage 89.37% 90.72% +1.35%
==========================================
Files 21 28 +7
Lines 1421 1672 +251
==========================================
+ Hits 1270 1517 +247
- Misses 151 155 +4 ☔ View full report in Codecov by Sentry. |
I think these resorces need to be removed, otherwise renet will spam a lot of errors. Going to figure it out + check the server logic properly.
I think we need to provide some sort of communication to handle replicon struct states properly. Let's keep it for the future.
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.
Review part 1
Co-authored-by: UkoeHB <37489173+UkoeHB@users.noreply.github.com>
For consistency.
Do not export conditions, plugins and schedules.
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.
Part 3
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.
Part 4 (done). Overall it's a clean abstraction, nice job!
src/server/replication_messages.rs
Outdated
@@ -662,7 +663,7 @@ fn write_with<'a>( | |||
} | |||
|
|||
fn can_pack(header_size: usize, base: usize, add: usize) -> bool { | |||
const MAX_PACKET_SIZE: usize = 1200; // https://github.com/lucaspoffo/renet/blob/acee8b470e34c70d35700d96c00fb233d9cf6919/renet/src/packet.rs#L7 | |||
const MAX_PACKET_SIZE: usize = 1200; |
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.
Maybe this should be configurable by the backend, can be done in a future PR.
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.
Added TODO.
Co-authored-by: UkoeHB <37489173+UkoeHB@users.noreply.github.com>
Co-authored-by: UkoeHB <37489173+UkoeHB@users.noreply.github.com>
Co-authored-by: UkoeHB <37489173+UkoeHB@users.noreply.github.com>
client.filter(|client| client.is_connected()).is_some() | ||
} | ||
|
||
/// Returns `true` if the server stopped on this tick. |
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.
@UkoeHB maybe clarity that it's not exactly on this tick, but more like since the condition run? Because if you run this condition again on the same "stopped" tick, it will return false
.
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.
- Bevy runs all run conditions every tick.
- Separate instances of this run condition will have different locals, so individual instances won't be run twice on the same tick.
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.
Ah, it's Bevy's tick. I assumed that we meant replicon tick as in other places.
With the current implementation in order to disconnect user need to write library-specific code. For example, in case of renet user will need to call
RenetClient::disconnect
or removeRenetClient
resource.I think we can do better by hidingI decided to keep only minimal functionality inRepliconServer::set_running
andRepliconClient::set_status
and providing events for messaging libraries and users to control it. But I will probably do it in a follow-up PR.RepliconServer
andRepliconClient
required for replicon to function.