Struct cyfs_bdt::StackConfig
source · pub struct StackConfig {
pub statistic_interval: Duration,
pub keystore: Config,
pub interface: Config,
pub sn_client: Config,
pub tunnel: Config,
pub stream: Config,
pub datagram: Config,
pub ndn: Config,
pub debug: Option<Config>,
}Fields§
§statistic_interval: Duration§keystore: Config§interface: Config§sn_client: Config§tunnel: Config§stream: Config§datagram: Config§ndn: Config§debug: Option<Config>Implementations§
source§impl StackConfig
impl StackConfig
sourcepub fn new(_isolate: &str) -> Self
pub fn new(_isolate: &str) -> Self
Examples found in repository?
examples/stream.rs (line 77)
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
async fn large_udp_stream_with_loss() {
let mut uploader_config = StackConfig::new("");
uploader_config.interface.udp.sim_loss_rate = 10;
let ((ln_stack, _), (rn_stack, _)) = utils::local_stack_pair_with_config(
&["W4udp127.0.0.1:10002"],
&["W4udp127.0.0.1:10003"],
Some(uploader_config),
None,
)
.await
.unwrap();
let (sample_size, sample) = utils::random_mem(1024, 512);
let (signal_sender, signal_recver) = channel::bounded::<BuckyResult<Vec<u8>>>(1);
{
let rn_stack = rn_stack.clone();
task::spawn(async move {
signal_sender
.send(recv_large_stream(rn_stack).await)
.await
.unwrap();
});
}
send_large_stream(&ln_stack, &rn_stack, sample.as_ref())
.await
.unwrap();
let recv = future::timeout(Duration::from_secs(5), signal_recver.recv())
.await
.unwrap()
.unwrap();
let recv_sample = recv.unwrap();
assert_eq!(recv_sample.len(), sample_size);
let sample_hash = hash_data(sample.as_ref());
let recv_hash = hash_data(recv_sample.as_ref());
assert_eq!(sample_hash, recv_hash);
}Trait Implementations§
source§impl Clone for StackConfig
impl Clone for StackConfig
source§fn clone(&self) -> StackConfig
fn clone(&self) -> StackConfig
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more