Hi, i was writing some async server-client connection to learn more rust. However for a long time i was unable to decide which crates should i use. I decided to use tokio as its the most popular, also i heard about flume which is a more efficient way of handling channels. My idea was to make 100% safe code, for some reason panics are not showing up when they appear in a different tokio task so i needed to handle it with Results, i decided to use anyhow because i dont need more complex error handling. So in order for it to work i needed to await every single task to redirect the error which means i needed to introduce graceful closing for everything. After some time I successfully done that. However i think that my pattern isnt the best and is very very uncovienient. I really need someone who is very familiar with rust ecosystem to review this code and propose any changes.
So i think that all i need to put here is the server's code as client was less complex and was using a similar logic.