aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-01-04 19:12:01 +0100
committerJokler <jokler.contact@gmail.com>2018-01-04 19:12:01 +0100
commit37056a823a574add2cd452a97f328bb170400a0b (patch)
tree0b7851f09eb003b532e533e715e72e8df6f809fe /bin
parent32e870aeefee587d6eabdfa08cf27b3cf9a46f15 (diff)
downloadfrippy-37056a823a574add2cd452a97f328bb170400a0b.tar.gz
frippy-37056a823a574add2cd452a97f328bb170400a0b.zip
Return the future on connect instead of adding it to the reactor
Diffstat (limited to 'bin')
-rw-r--r--bin/main.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/bin/main.rs b/bin/main.rs
index c9749b6..ac25a93 100644
--- a/bin/main.rs
+++ b/bin/main.rs
@@ -78,7 +78,7 @@ fn main() {
// Create an event loop to run the connections on.
let mut reactor = Core::new().unwrap();
- let mut task = false;
+ let mut futures = Vec::new();
// Open a connection and add work for each config
for config in configs {
@@ -105,11 +105,9 @@ fn main() {
}
}
- bot.connect(&mut reactor, &config).map(|_| task = true);
+ futures.push(bot.connect(&mut reactor, &config));
}
- if task {
- // Run the main loop forever
- reactor.run(future::empty::<(), ()>()).unwrap();
- }
+ // Run the bots until they throw an error
+ reactor.run(future::join_all(futures)).unwrap();
}