shotover / shotover-proxy

L7 data-layer proxy
https://docs.shotover.io
Apache License 2.0
84 stars 16 forks source link

SinkConnection improvements #1569

Closed rukai closed 5 months ago

rukai commented 5 months ago

This PR improves SinkConnection to be more robust and efficient. https://github.com/shotover/shotover-proxy/pull/1565 started on this work but I didnt realize how deep the issue went.

  1. First I realized that the fix in #1565 only fixed try_recv. recv had the same issue and that was unfixed. So this PR adds the fix to recv as well.
  2. I realized that fixing #1565 introduced a bunch of needless allocations. The fix to this is to have the user pass in the &mut Vec<Message> that they will be adding to. This is a fairly ergonomic solution since sinks often directly append the result to another vec anyway.
    • In doing this I renamed recv -> recv_into and try_recv -> try_recv_into to better suit the new functionality.
    • Additionally I had to port all the transforms to use this new API.