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

Question: shutdown_complete_rx never used in the Listner #88

Open
Aklenor opened this issue Nov 28, 2021 · 2 comments
Open

Question: shutdown_complete_rx never used in the Listner #88

Aklenor opened this issue Nov 28, 2021 · 2 comments

Comments

@Aklenor
Copy link

Aklenor commented Nov 28, 2021

Why do you put shutdown_complete_rx: mpsc::Receiver<()> into Listner struct if it never used inside of it?

shutdown_complete_rx: mpsc::Receiver<()>,

while shutdown_complete_tx: mpsc::Sender<()> seems reasonable for me.

@Darksonn
Copy link
Collaborator

The receiver is used here:

mini-redis/src/server.rs

Lines 203 to 207 in ebe4e1f

// Wait for all active connections to finish processing. As the `Sender`
// handle held by the listener has been dropped above, the only remaining
// `Sender` instances are held by connection handler tasks. When those drop,
// the `mpsc` channel will close and `recv()` will return `None`.
let _ = shutdown_complete_rx.recv().await;

Aklenor added a commit to Aklenor/mini-redis that referenced this issue Nov 29, 2021
Fix tokio-rs#88 remove unused field from the Listner struct
@Aklenor
Copy link
Author

Aklenor commented Nov 29, 2021

I see that but why to put it inside of the Listner struct, if you use it only in run function. I made PR with changes that I mean.

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

Successfully merging a pull request may close this issue.

2 participants