Skip to content
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

Merged
merged 2 commits into from
Jun 4, 2020
Merged

Conversation

markmandel
Copy link
Contributor

Implementation plus unit tests!

Work on #1

Implementation plus unit tests!

Work on #1
@markmandel markmandel added kind/feature New feature or request area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc labels Jun 2, 2020
Copy link
Collaborator

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!


recv_udp_done(recv_socket, done);

if let Err(err) = send_packet
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

@markmandel markmandel Jun 3, 2020

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, this is nicer!

@markmandel markmandel merged commit dd8d248 into master Jun 4, 2020
@markmandel markmandel deleted the feature/local_send_filter branch June 4, 2020 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants