projects
/
dnsseed-rust
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
57dd4b0
)
Dont ever run two scan threads
author
Matt Corallo
<git@bluematt.me>
Tue, 21 May 2019 14:35:18 +0000
(10:35 -0400)
committer
Matt Corallo
<git@bluematt.me>
Tue, 21 May 2019 14:35:18 +0000
(10:35 -0400)
src/main.rs
patch
|
blob
|
history
diff --git
a/src/main.rs
b/src/main.rs
index ae38a5bc3e6845fcf3a658812f49233339673873..3086731dc96f71946fc7f59b5cf8c806070be185 100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-33,6
+33,7
@@
static mut HEIGHT_MAP: Option<Box<Mutex<HashMap<u64, sha256d::Hash>>>> = None;
static mut DATA_STORE: Option<Box<Store>> = None;
static mut PRINTER: Option<Box<Printer>> = None;
pub static START_SHUTDOWN: AtomicBool = AtomicBool::new(false);
static mut DATA_STORE: Option<Box<Store>> = None;
static mut PRINTER: Option<Box<Printer>> = None;
pub static START_SHUTDOWN: AtomicBool = AtomicBool::new(false);
+static SCANNING: AtomicBool = AtomicBool::new(false);
struct PeerState {
request: (u64, sha256d::Hash),
struct PeerState {
request: (u64, sha256d::Hash),
@@
-263,7
+264,9
@@
fn make_trusted_conn(trusted_sockaddr: SocketAddr) {
= (headers.last().unwrap().bitcoin_hash(), top_height);
printer.set_stat(printer::Stat::HeaderCount(top_height));
if top_height >= starting_height as u64 {
= (headers.last().unwrap().bitcoin_hash(), top_height);
printer.set_stat(printer::Stat::HeaderCount(top_height));
if top_height >= starting_height as u64 {
- scan_net();
+ if !SCANNING.swap(true, Ordering::SeqCst) {
+ scan_net();
+ }
}
} else {
// Wat? Lets start again...
}
} else {
// Wat? Lets start again...