Skip to content
  • David Goulet's avatar
    chan: Do not re-queue after a fail cell write · 6120efd7
    David Goulet authored and Nick Mathewson's avatar Nick Mathewson committed
    
    
    Couple things happen in this commit. First, we do not re-queue a cell back in
    the circuit queue if the write packed cell failed. Currently, it is close to
    impossible to have it failed but just in case, the channel is mark as closed
    and we move on.
    
    The second thing is that the channel_write_packed_cell() always took ownership
    of the cell whatever the outcome. This means, on success or failure, it needs
    to free it.
    
    It turns out that that we were using the wrong free function in one case and
    not freeing it in an other possible code path. So, this commit makes sure we
    only free it in one place that is at the very end of
    channel_write_packed_cell() which is the top layer of the channel abstraction.
    This makes also channel_tls_write_packed_cell_method() return a negative value
    on error.
    
    Two unit tests had to be fixed (quite trivial) due to a double free of the
    packed cell in the test since now we do free it in all cases correctly.
    
    Part of #23709
    
    Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
    6120efd7