tor-proto: Add TODO regarding allow_stream_requests corner case.

This commit is contained in:
Gabriela Moldovan 2023-07-31 01:05:58 +01:00
parent f30c5897cc
commit 907d8cf255
No known key found for this signature in database
GPG Key ID: 3946E0ADE72BAC99
1 changed files with 24 additions and 0 deletions

View File

@ -436,6 +436,9 @@ impl ClientCirc {
///
/// Only onion services (and eventually) exit relays should call this
/// method.
//
// TODO HSS: this function should return an error if allow_stream_requests()
// was already called on this circuit.
#[cfg(feature = "hs-service")]
pub fn allow_stream_requests(
self: &Arc<ClientCirc>,
@ -1837,6 +1840,27 @@ mod test {
assert_eq!(p.initial_send_window(), 500);
}
#[test]
// TODO HSS: allow_stream_requests() should return an error if
// the circuit already has an IncomingStream.
#[ignore]
#[cfg(feature = "hs-service")]
fn allow_stream_requests_twice() {
tor_rtcompat::test_with_all_runtimes!(|rt| async move {
let (chan, _rx, _sink) = working_fake_channel(&rt);
let (circ, _send) = newcirc(&rt, chan).await;
let _incoming = circ
.allow_stream_requests(&[tor_cell::relaycell::RelayCmd::BEGIN])
.unwrap();
let incoming = circ.allow_stream_requests(&[tor_cell::relaycell::RelayCmd::BEGIN]);
// There can only be one IncomingStream at a time on any given circuit.
assert!(incoming.is_err());
});
}
#[test]
#[cfg(feature = "hs-service")]
fn allow_stream_requests() {