@@ -58,8 +58,14 @@ pub struct MixnetClientConfig {
5858
5959 /// The minimum performance of gateways to use.
6060 pub min_gateway_performance : Option < u8 > ,
61- }
61+ ///Setting optionally the poisson rate for cover traffic stream
62+ pub poisson_rate : Option < u32 > ,
63+ /// Average packet delay in milliseconds.
64+ pub average_packet_delay : Option < u32 > ,
6265
66+ /// Average message sending delay in milliseconds.
67+ pub message_sending_average_delay : Option < u32 > ,
68+ }
6369impl BuilderConfig {
6470 pub fn mixnet_client_debug_config ( & self ) -> DebugConfig {
6571 if self . two_hops {
@@ -156,8 +162,15 @@ fn two_hop_debug_config(mixnet_client_config: &MixnetClientConfig) -> DebugConfi
156162 if let Some ( min_gateway_performance) = mixnet_client_config. min_gateway_performance {
157163 debug_config. topology . minimum_gateway_performance = min_gateway_performance;
158164 }
165+ if let Some ( avg_packet_ms) = mixnet_client_config. average_packet_delay {
166+ debug_config. traffic . average_packet_delay = Duration :: from_millis ( avg_packet_ms as u64 ) ;
167+ debug_config. acknowledgements . average_ack_delay = Duration :: from_millis ( avg_packet_ms as u64 ) ;
168+
169+ }
159170
160- log_mixnet_client_config ( & debug_config) ;
171+ if let Some ( msg_delay_ms) = mixnet_client_config. message_sending_average_delay {
172+ debug_config. traffic . message_sending_average_delay = Duration :: from_millis ( msg_delay_ms as u64 ) ;
173+ } log_mixnet_client_config ( & debug_config) ;
161174 debug_config
162175}
163176
@@ -179,7 +192,19 @@ fn mixnet_debug_config(mixnet_client_config: &MixnetClientConfig) -> DebugConfig
179192 if let Some ( min_gateway_performance) = mixnet_client_config. min_gateway_performance {
180193 debug_config. topology . minimum_gateway_performance = min_gateway_performance;
181194 }
182- log_mixnet_client_config ( & debug_config) ;
195+ if let Some ( avg_packet_ms) = mixnet_client_config. average_packet_delay {
196+ debug_config. traffic . average_packet_delay = Duration :: from_millis ( avg_packet_ms as u64 ) ;
197+ debug_config. acknowledgements . average_ack_delay =Duration :: from_millis ( avg_packet_ms as u64 ) ;
198+ }
199+
200+ if let Some ( msg_delay_ms) = mixnet_client_config. message_sending_average_delay {
201+ debug_config. traffic . message_sending_average_delay = Duration :: from_millis ( msg_delay_ms as u64 ) ;
202+ }
203+ if let Some ( poisson_rate) = mixnet_client_config. poisson_rate {
204+ let duration = std:: time:: Duration :: from_millis ( ( poisson_rate as f64 ) . round ( ) as u64 ) ;
205+ debug_config. cover_traffic . loop_cover_traffic_average_delay = duration;
206+
207+ } log_mixnet_client_config ( & debug_config) ;
183208 debug_config
184209}
185210
0 commit comments