Skip to content

onion-tunnel/proxy: fix broken InteractiveCopier

eta requested to merge eta/fix-copier into main
  • The InteractiveCopier was subtly broken; if the destination partially wrote something, it would duplicate data (in pathological cases, looping forever).
  • This unsurprisingly resulted in garbled TCP connections that subtly broke everything.
  • Fix this oversight, and introduce a test that catches this kind of failure case.
    • The BoundedWriter test harness forces partial writes.
    • It also panics if the copier tries to write too much, as without this feature the (broken) copier would just loop indefinitely.
  • A future commit should refactor the copier, which was written by eta in a fit of Brussels-induced overconfidence (see also f173e44c, "oops yolo"), to be a bit less prone to this sort of error.
    • trinity suggested factoring out the buffer logic, which I will go and do next!

Merge request reports

Loading