Skip to content

tor-cell: Add `UnparsedRelayMsg::data_len`

This adds a data_len() method to UnparsedRelayMsg, which allows us to get the "length" field of a UnparsedRelayMsg. We want this so that as the circuit reactor queues UnparsedRelayMsgs for a StreamReader, we can know how many data bytes are queued and can make congestion control decisions using that information.

I'm unsure if we should do bounds checking here (a malicious relay might send a cell with a data length of u16::MAX), but for now I think we can leave it up to the caller to do any checks that it needs.

/cc @dgoulet
/cc @nickm (since this involves the V1 cell format)

Edited by opara

Merge request reports

Loading