node: Fix bug when socket file is deleted
If the socket file is deleted while the node is running, we can no longer quit with Ctrl-C. This is the "fix".
This commit is contained in:
parent
97f7064094
commit
b29ce1a222
|
|
@ -230,13 +230,15 @@ impl<G: Signer + EcSign + 'static> Runtime<G> {
|
||||||
|
|
||||||
self.pool.run().unwrap();
|
self.pool.run().unwrap();
|
||||||
self.reactor.join().unwrap();
|
self.reactor.join().unwrap();
|
||||||
control.join().unwrap()?;
|
|
||||||
|
|
||||||
daemon::kill(&daemon).ok(); // Ignore error if daemon has already exited, for whatever reason.
|
daemon::kill(&daemon).ok(); // Ignore error if daemon has already exited, for whatever reason.
|
||||||
daemon.wait()?;
|
daemon.wait()?;
|
||||||
|
|
||||||
fs::remove_file(home.socket()).ok();
|
// If the socket file was deleted by some other process, for whatever reason,
|
||||||
|
// the control thread will not be able to join.
|
||||||
|
if fs::remove_file(home.socket()).is_ok() {
|
||||||
|
control.join().unwrap()?;
|
||||||
|
}
|
||||||
log::debug!(target: "node", "Node shutdown completed for {}", self.id);
|
log::debug!(target: "node", "Node shutdown completed for {}", self.id);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue