File tree Expand file tree Collapse file tree 6 files changed +145
-88
lines changed Expand file tree Collapse file tree 6 files changed +145
-88
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ rand = "0.8.5"
2525hex = {version = " 0.4.3" }
2626futures = " 0.3.30"
2727console-subscriber = { version = " 0.4.0" , optional = true }
28+ tokio-util = { version = " 0.7.13" , features = [" rt" ] }
2829
2930[features ]
3031dev = [" console-subscriber" ]
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use std::collections::HashMap;
1212use std:: path:: PathBuf ;
1313use std:: sync:: Arc ;
1414use tokio:: sync:: Mutex ;
15+ use tokio_util:: task:: TaskTracker ;
1516
1617/// The default directory where the simulation files are stored and where the results will be written to.
1718pub const DEFAULT_DATA_DIR : & str = "." ;
@@ -209,6 +210,7 @@ async fn main() -> anyhow::Result<()> {
209210 None
210211 } ;
211212
213+ let tasks = TaskTracker :: new ( ) ;
212214 let sim = Simulation :: new (
213215 SimulationCfg :: new (
214216 cli. total_time ,
@@ -219,6 +221,7 @@ async fn main() -> anyhow::Result<()> {
219221 ) ,
220222 clients,
221223 validated_activities,
224+ tasks,
222225 ) ;
223226 let sim2 = sim. clone ( ) ;
224227
@@ -233,16 +236,18 @@ async fn main() -> anyhow::Result<()> {
233236}
234237
235238async fn read_sim_path ( data_dir : PathBuf , sim_file : PathBuf ) -> anyhow:: Result < PathBuf > {
236- let sim_path = if sim_file. is_relative ( ) {
237- data_dir. join ( sim_file)
238- } else {
239- sim_file
240- } ;
241-
242- if sim_path. exists ( ) {
243- Ok ( sim_path)
239+ if sim_file. exists ( ) {
240+ Ok ( sim_file)
241+ } else if sim_file. is_relative ( ) {
242+ let sim_path = data_dir. join ( sim_file) ;
243+ if sim_path. exists ( ) {
244+ Ok ( sim_path)
245+ } else {
246+ log:: info!( "Simulation file '{}' does not exist." , sim_path. display( ) ) ;
247+ select_sim_file ( data_dir) . await
248+ }
244249 } else {
245- log:: info!( "Simulation file '{}' does not exist." , sim_path . display( ) ) ;
250+ log:: info!( "Simulation file '{}' does not exist." , sim_file . display( ) ) ;
246251 select_sim_file ( data_dir) . await
247252 }
248253}
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ serde_millis = "0.1.1"
3232rand_distr = " 0.4.3"
3333mockall = " 0.12.1"
3434rand_chacha = " 0.3.1"
35+ tokio-util = { version = " 0.7.13" , features = [" rt" ] }
3536
3637[dev-dependencies ]
3738ntest = " 0.9.0"
You can’t perform that action at this time.
0 commit comments