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

Are the methods implemented on Websocket cancellation-safe? #6

Open
cactusdualcore opened this issue Jan 14, 2022 · 1 comment
Open

Comments

@cactusdualcore
Copy link

Is cancellation of futures yielded by methods of this library (e.g. Websocket::receive) safe?

Imagine a scenario like this

async fn foo() {
  // ...
  tokio::select!{
    _ = done_soon() => {
      do_stuff()
    },
    _ = websocket.receive() => {
      // ...
    }
  }
}

If done_soon finishes while Websocket::receive processes an incoming Frame, will the frame be lost?

@imranmaj
Copy link
Owner

imranmaj commented Sep 3, 2022

Sorry for the late response on this. At the moment I don't think they are cancellation safe, that's a very good point. They definitely should be though. That will be my next task on this project when I have time; anyone can feel free to submit a PR as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants