Launch single-thread executor on own thread
[?]
Oct 27, 2018, 1:54 PM
6DSWVNSYTGYN33VFBLXK655PFELW5ED2IFB2IZVHM4X277QRVUFACDependencies
Change contents
- edit in src/main.rs at line 1
#![deny(missing_docs)]//! XMPP client service - edit in src/main.rs at line 17
use tokio::prelude::future;use tokio::runtime::current_thread; - replacement in src/main.rs at line 57
hyper::rt::run(http_server);let mut rt = Runtime::new().expect("Cann't start tokio");rt.spawn(http_server);let xmpp_join = std::thread::spawn(|| -> Result<(), tokio::io::Error> {// Launch single-threaded runtimelet mut ctrt = current_thread::Runtime::new()?;ctrt.block_on(future::ok::<_, tokio::io::Error>(()))});println!("Server started");rt.shutdown_on_idle().wait().expect("Shutdown error");println!("Server stopper");xmpp_join.join().expect("Join xmpp thread").expect("Result xmpp thread");