Body::channel()) is probably the least of your worries
I did some a while ago, but just to make sure I did one again. The XML parsing and aggregation part takes about 37s. This could likely also be improved, but it still leaves ~2.5min for the JSON sending. Or rather for the JSON building from internal data structures and sending.
I was thinking that the sending takes so long, because it makes a difference in how long the whole thing takes whether I send very small pieces or whether I first build larger JSON pieces and then send those.
@inzanez It turns out we should be downcasting to
TcpStream. From there you can access inner
TcpStream if you want:
let upgraded_parts = upgraded.downcast::<AddrStream>().unwrap(); let upgraded_tcp_stream = upgraded_parts.io.into_inner();
Credit to sfackler on Discord.