mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 08:51:08 +03:00
servers, util: fix deadlock caused by conflicting lock order (#3340)
This commit is contained in:
parent
c54568e69f
commit
992d450e0a
2 changed files with 7 additions and 4 deletions
|
@ -714,11 +714,13 @@ impl WorkersList {
|
||||||
}
|
}
|
||||||
pub fn remove_worker(&self, worker_id: usize) {
|
pub fn remove_worker(&self, worker_id: usize) {
|
||||||
self.update_stats(worker_id, |ws| ws.is_connected = false);
|
self.update_stats(worker_id, |ws| ws.is_connected = false);
|
||||||
self.workers_list
|
let mut stratum_stats = self.stratum_stats.write();
|
||||||
.write()
|
let mut workers_list = self.workers_list.write();
|
||||||
|
workers_list
|
||||||
.remove(&worker_id)
|
.remove(&worker_id)
|
||||||
.expect("Stratum: no such addr in map");
|
.expect("Stratum: no such addr in map");
|
||||||
self.stratum_stats.write().num_workers = self.workers_list.read().len();
|
|
||||||
|
stratum_stats.num_workers = workers_list.len();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn login(&self, worker_id: usize, login: String, agent: String) -> Result<(), RpcError> {
|
pub fn login(&self, worker_id: usize, login: String, agent: String) -> Result<(), RpcError> {
|
||||||
|
|
|
@ -150,6 +150,8 @@ pub fn init_logger(config: Option<LoggingConfig>, logs_tx: Option<mpsc::SyncSend
|
||||||
*tui_running_ref = true;
|
*tui_running_ref = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut was_init_ref = WAS_INIT.lock();
|
||||||
|
|
||||||
// Save current logging configuration
|
// Save current logging configuration
|
||||||
let mut config_ref = LOGGING_CONFIG.lock();
|
let mut config_ref = LOGGING_CONFIG.lock();
|
||||||
*config_ref = c.clone();
|
*config_ref = c.clone();
|
||||||
|
@ -250,7 +252,6 @@ pub fn init_logger(config: Option<LoggingConfig>, logs_tx: Option<mpsc::SyncSend
|
||||||
);
|
);
|
||||||
|
|
||||||
// Mark logger as initialized
|
// Mark logger as initialized
|
||||||
let mut was_init_ref = WAS_INIT.lock();
|
|
||||||
*was_init_ref = true;
|
*was_init_ref = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue