Skip to content
  • David Goulet's avatar
    Fix cases where edge connections can stall. · 2bb89886
    David Goulet authored
    
    
    We discovered two cases where edge connections can stall during testing:
      1. Due to final data sitting in the edge inbuf when it was resumed
      2. Due to flag synchronization between the token bucket and XON/XOFF
    
    The first issue has always existed in C-Tor, but we were able to tickle it
    in scp testing. If the last data from the protocol is able to fit in the
    inbuf, but not large enough to send, if an XOFF or connection block comes in
    at exactly that point, when the edge connection resumes, there will be no
    data to read from the socket, but the inbuf can just sit there, never
    draining.
    
    We noticed the second issue along the way to finding the first. It seems
    wrong, but it didn't seem to affect anything in practice.
    
    These are extremely rare in normal operation, but with conflux, XON/XOFF
    activity is more common, so we hit these.
    
    Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
    2bb89886