summaryrefslogtreecommitdiffstats
path: root/ipfs-api/examples/bootstrap_default.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ipfs-api/examples/bootstrap_default.rs')
-rw-r--r--ipfs-api/examples/bootstrap_default.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/ipfs-api/examples/bootstrap_default.rs b/ipfs-api/examples/bootstrap_default.rs
index 6ba9575..bc36952 100644
--- a/ipfs-api/examples/bootstrap_default.rs
+++ b/ipfs-api/examples/bootstrap_default.rs
@@ -6,7 +6,10 @@
// copied, modified, or distributed except according to those terms.
//
+#[cfg(feature = "actix")]
+extern crate actix_web;
extern crate futures;
+#[cfg(feature = "hyper")]
extern crate hyper;
extern crate ipfs_api;
@@ -42,8 +45,7 @@ fn main() {
}
});
- hyper::rt::run(
- bootstrap
+ let fut = bootstrap
.and_then(|_| {
println!();
println!("dropping all bootstrap peers...");
@@ -56,6 +58,15 @@ fn main() {
add
})
- .map_err(|e| eprintln!("{}", e)),
- );
+ .map_err(|e| eprintln!("{}", e));
+
+ #[cfg(feature = "hyper")]
+ hyper::rt::run(fut);
+ #[cfg(feature = "actix")]
+ actix_web::actix::run(|| {
+ fut.then(|_| {
+ actix_web::actix::System::current().stop();
+ Ok(())
+ })
+ });
}