Hi! This is my first post here. I’m trying to write a simple TCP proxy using Tokio and its async features.
I followed the example from the documentation and it works correctly.
I’m now trying to modify it so that it stores the content of both the request and the response in a buffer so I can read/change the content more easily, but that brakes the chain.
In particular the initial synchronisation step works correctly but once the request has to be sent to the server it stops until the client sends the timeout FIN-ACK, then the request is sent correctly to the server and the response gets back to the client HalfWriter, but since the client already disconnected I receive an error.
I already tried changing the position of the shutdown calls; having both the shutdown calls at the very end or building a chain in the order of execution; calling flush after the write; …
Can anybody point out what the problem on my code is?
Here is the complete code: https://gitlab.com/snippets/1850889
Thank you in advance!