-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: use async trait #323
Conversation
56c49b8
to
ef647d0
Compare
@@ -536,25 +420,33 @@ where | |||
// Send data to the specified protocol for the specified session. | |||
TargetSession::Single(id) => { | |||
if let Some(control) = self.sessions.get_mut(&id) { | |||
control.push_message(proto_id, priority, data); | |||
control.try_send(cx); | |||
control.inner.incr_pending_data_size(data.len()); |
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.
Better incr_pending_data_size()
inside control.send()
(by destruct SessionEvent::ProtocolMessage
) in case we don't forget it before send ProtocolMessage
.
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.
incr_pending_data_size
only exists in this function, there is no need for the operation of this function to cause all other commands to also carry the destruct operation
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.
Reviewed 37 of 37 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @driftluo)
ref #305
This PR achieves a complete migration to the async trait, users can write code in async env
tentacle/src/traits.rs
is the core of the modificationtentacle/src/channel/bound.rs
Channels adds two async methods that do not use mut to facilitate the uniformity of the user interface and avoid unnecessary mut markstentacle/src/protocol_handle_stream.rs
andtentacle/src/service.rs
as the place to inherit the implementation of the user’s async trait, part of the logic is inevitably rewrittenOther changes are due to the changes caused by the above changes
This change is