summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2018-07-12 18:50:06 +0300
committerYuval Adam <_@yuv.al>2018-07-12 18:50:06 +0300
commite099b90492681b070a0e964a50f8f0aa1b0730b0 (patch)
tree1183b4d4827a2930557b76019126019fba047c78 /src
parent6ab657f0e6211aed4452ba7b0e06e803b25c8ccc (diff)
Run HTTP server on a separate thread, all good
Diffstat (limited to 'src')
-rw-r--r--src/main.rs47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/main.rs b/src/main.rs
index 398e76d..a56c7fd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -48,31 +48,34 @@ fn main() {
process::exit(1);
}
- serve::run();
- // let _udp = thread::spawn(move || {
- // upnp::discover();
- // });
+ let _http = thread::spawn(move || {
+ serve::run();
+ });
- // let (tx, rx) = mpsc::channel();
- // let child = thread::spawn(move || {
- // let mut controller = cli::Controller::init();
- // loop {
- // let c = controller.read();
- // tx.send(c).unwrap();
- // if c == 113 {
- // break;
- // }
- // }
- // controller.destroy();
- // });
+ let _udp = thread::spawn(move || {
+ upnp::discover();
+ });
- // for received in rx {
- // println!("Got char: {}", received);
- // }
+ let (tx, rx) = mpsc::channel();
+ let child = thread::spawn(move || {
+ let mut controller = cli::Controller::init();
+ loop {
+ let c = controller.read();
+ tx.send(c).unwrap();
+ if c == 113 {
+ break;
+ }
+ }
+ controller.destroy();
+ });
- // println!("Waiting for all thread");
- // let _res = child.join();
- // println!("Done!");
+ for received in rx {
+ println!("Got char: {}", received);
+ }
+
+ println!("Waiting for all thread");
+ let _res = child.join();
+ println!("Done!");
}