Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Worker panic leave mutex in poisoned status (#100)
Browse files Browse the repository at this point in the history
Solution: propagate panic to quit the whole server.
yihuang authored and tomtau committed Nov 18, 2019
1 parent b4a39b5 commit 6af5423
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ use tokio::codec::Decoder;
use tokio::io;
use tokio::net::TcpListener;
use tokio::prelude::*;
use tokio::runtime;

use crate::codec::ABCICodec;
use crate::messages::abci::*;
@@ -43,7 +44,15 @@ where
});
tokio::spawn(writes.then(|_| Ok(())))
});
tokio::run(server);

let mut rt = runtime::Builder::new()
.panic_handler(|_err| {
std::process::exit(1);
// std::panic::resume_unwind(err);
})
.build()
.unwrap();
rt.block_on(server).unwrap();
Ok(())
}

0 comments on commit 6af5423

Please sign in to comment.