-
Notifications
You must be signed in to change notification settings - Fork 98
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
Implementation of local_send_filter #55
Conversation
Implementation plus unit tests! Work on #1
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!
src/server/server.rs
Outdated
|
||
recv_udp_done(recv_socket, done); | ||
|
||
if let Err(err) = send_packet |
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.
wondering if this might be simpler unwraping the result since we're not verifying this part e.g send_packet.send(...).await.unwrap();
? or if the result isn't debuggable, asserting that it's ok e.g assert!(send_packet.send(...).await.is_ok());
? I'm not sure either makes it more ergonomic tbh so feel free to leave as is.
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.
Hmnn, that's a good point. Lemme try the unwrap()
that would seem like it would be simpler.
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! So there is no unwrap:
error[E0599]: no method named `unwrap` found for enum `std::result::Result<(), tokio::sync::mpsc::error::SendError<server::sessions::Packet>>` in the current scope
--> src/server/server.rs:621:14
|
621 | .unwrap();
| ^^^^^^ method not found in `std::result::Result<(), tokio::sync::mpsc::error::SendError<server::sessions::Packet>>`
|
= note: the method `unwrap` exists but the following trait bounds were not satisfied:
`tokio::sync::mpsc::error::SendError<server::sessions::Packet> : std::fmt::Debug`
So I think we can leave it as it is.
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, I think this is a tad nicer -
send_packet
.send(Packet::new(local_addr, msg.as_bytes().to_vec()))
.await
.map_err(|err| assert!(false, err))
.unwrap();
WDYT?
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.
Agree, this is nicer!
Implementation plus unit tests!
Work on #1