fix rescan crash: shutdown old lightclient before overwriting
This commit is contained in:
@@ -14,5 +14,5 @@
|
||||
|
||||
| File | SHA-256 |
|
||||
|---|---|
|
||||
| `SilentDragonXLite` (Linux) | `17b34e63bce97dcb53eb930b6766aca88c7388303cc34db57d11db96afae5f48` |
|
||||
| `SilentDragonXLite.exe` (Windows) | `ce2df9860927a07459ef50231e4c133a07a96891b668e90187849492f96ec125` |
|
||||
| `SilentDragonXLite` (Linux) | `bc5e0020d784a905e2d461ccb5b4c5da4436072245370ec9e09a17e9e7ad0307` |
|
||||
| `SilentDragonXLite.exe` (Windows) | `47f45ff44521eb46ee87189ee2318d0ca61f44b39c2a9d875e1a3d7329700df8` |
|
||||
|
||||
Binary file not shown.
@@ -140,6 +140,17 @@ pub extern "C" fn litelib_initialize_new_from_phrase(dangerous: bool, server: *c
|
||||
|
||||
//println!("Initializing with server: {}, seed: {}", server_str, seed_str);
|
||||
|
||||
// Shut down the existing client if one is running, to stop background threads
|
||||
if overwrite {
|
||||
let old_lc = match LIGHTCLIENT.lock() {
|
||||
Ok(l) => l.borrow().clone(),
|
||||
Err(poisoned) => poisoned.into_inner().borrow().clone(),
|
||||
};
|
||||
if let Some(lc) = old_lc {
|
||||
lc.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
let server = LightClientConfig::get_server_or_default(Some(server_str));
|
||||
let (config, _latest_block_height) = match LightClientConfig::create(server, dangerous) {
|
||||
Ok((c, h)) => {
|
||||
|
||||
Reference in New Issue
Block a user