Skip to content

tokio::{select, net::TcpListener} not mixing well #7332

Answered by Darksonn
amitu asked this question in Q&A
Discussion options

You must be logged in to vote

The problem is that you're calling accept() twice. For one of the calls, you ignore errors, and for the other call you ignore successful calls. The connection refused happens when the Err() branch accepts a connection and immediately throws it away since it's not an error. You have to instead match on the result after the => instead of using two branches on the select!.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by amitu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants