Hey,
I'm trying to write a simple program with async/tokio and might need to have my mental model of everything adjusted a bit.
I'm used to writing event loops by hand (i.e. using epoll).
In my use case I have 2 top level FDs, a signal FD an a socket server.
So I've written in my main (pseudo-code):
loop {
tokio::select! {
_ = signal_stream.recv() => {
println!("got sig");
}
_ = /* socket server something*/ => {
// accept client
}
}
}
Now, I'm blocked on what should I do once I accept the client.
If I was writing an epoll based event loop, I'd register the client on the epoll and return to the loop.
In this case, I'm not sure what to do with the client.
AFAICT I can't add it to the select!
. What happens if I .await
on its recv method inside the select!
block?
Hope this question is not too vague.
Thanks