• David Goulet's avatar
    sendme: Refactor SENDME cell processing · 9c42cc1e
    David Goulet authored
    This is a bit of a complicated commit. It moves code but also refactors part
    of it. No behavior change, the idea is to split things up so we can better
    handle and understand how SENDME cells are processed where ultimately it will
    be easier to handle authenticated SENDMEs (prop289) using the intermediate
    functions added in this commit.
    The entry point for the cell arriving at the edge (Client or Exit), is
    connection_edge_process_relay_cell() for which we look if it is a circuit or
    stream level SENDME. This commit refactors that part where two new functions
    are introduced to process each of the SENDME types.
    The sendme_process_circuit_level() has basically two code paths. If we are a
    Client (the circuit is origin) or we are an Exit. Depending on which, the
    package window is updated accordingly. Then finally, we resume the reading on
    every edge streams on the circuit.
    The sendme_process_stream_level() applies on the edge connection which will
    update the package window if needed and then will try to empty the inbuf if
    need be because we can now deliver more cells.
    Again, no behavior change but in order to split that code properly into their
    own functions and outside the relay.c file, code modification was needed.
    Part of #26840.
    Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>