-
Notifications
You must be signed in to change notification settings - Fork 349
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
Remove EventCallback
#7251
Remove EventCallback
#7251
Conversation
3990330
to
cf3089f
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.
Reviewed 2 of 5 files at r2.
Reviewable status: 1 of 5 files reviewed, all discussions resolved
talpid-openvpn/src/lib.rs
line 305 at r2 (raw file):
openvpn_init_args, event_server::OpenvpnEventProxyImpl { event_hook: tokio::sync::Mutex::new(event_hook),
If you use tokios mpsc-channels you won't need to wrap this in a Mutex
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.
Reviewable status: 1 of 5 files reviewed, all discussions resolved (waiting on @hulthe)
talpid-openvpn/src/lib.rs
line 305 at r2 (raw file):
Previously, hulthe (Joakim Hulthe) wrote…
If you use tokios mpsc-channels you won't need to wrap this in a Mutex
I opted to simply clone the event_hook
on each call for simplicity. I assume that is quite cheep to do, although the neither the docs for tokio or futures mpsc mention anything about the cost.
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.
LGTM 💰
Reviewed 2 of 5 files at r2, 1 of 1 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
talpid-openvpn/src/lib.rs
line 305 at r2 (raw file):
Previously, Serock3 (Sebastian Holmin) wrote…
I opted to simply clone the
event_hook
on each call for simplicity. I assume that is quite cheep to do, although the neither the docs for tokio or futures mpsc mention anything about the cost.
It's holding an Arc internally, so the cost is just Cloning that.
I personally still would prefer using tokios channel and avoiding the clones, but I won't make a fuss of it :)
cf3089f
to
6960dae
Compare
6960dae
to
ca17aee
Compare
The event callback was a dynamically typed async closure, which resulted in verbose type bounds. I replaced it with a simple concrete type, as there was only ever a single instance of it anyway.
This change is