Tokio: spawn loop_fn

#1

Hi

I am currently playing around with tokio and try to use loop_fn, but I have a hard time getting my code to work. The code should just connect to a socket several times and for each connection try until the connection could be established successfully. Here is a link to my current code:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=082df7950c8e2e72a6bb578b65978101

My understanding is that loop_fn is a future that returns a value and spawn accepts only futures that return no results, but I am not sure if that is correct and how I could fix this in case it is correct. Anyone has an idea?

0 Likes