mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
introduce an async version of stratum server. (#2468)
It seems that current approach stops workring after amount of parallel connection exceeds ~500. This PR introduces an 'async' feature which enable asyncronius, tokio based implementation of stratum server. * fix bug with passing current_difficulty in Handler I passed in Handler current_difficulty as an u64, so it was copied and all later changes were ignored. In this commit I pass referece on RwLock with current_difficulty. * fix crash in build_block * improve error handling * print error message on unknown error * replace original server by tokio based one * fixes after review * reduce sleep time in mail loop to 5ms
This commit is contained in:
parent
d8605a4d51
commit
0d36acf01b
4 changed files with 582 additions and 514 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -894,6 +894,7 @@ dependencies = [
|
||||||
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -24,6 +24,7 @@ serde_json = "1"
|
||||||
chrono = "0.4.4"
|
chrono = "0.4.4"
|
||||||
bufstream = "~0.1"
|
bufstream = "~0.1"
|
||||||
jsonrpc-core = "~8.0"
|
jsonrpc-core = "~8.0"
|
||||||
|
tokio = "0.1.11"
|
||||||
|
|
||||||
grin_api = { path = "../api", version = "1.0.1" }
|
grin_api = { path = "../api", version = "1.0.1" }
|
||||||
grin_chain = { path = "../chain", version = "1.0.1" }
|
grin_chain = { path = "../chain", version = "1.0.1" }
|
||||||
|
|
|
@ -302,12 +302,12 @@ impl Server {
|
||||||
self.chain.clone(),
|
self.chain.clone(),
|
||||||
self.tx_pool.clone(),
|
self.tx_pool.clone(),
|
||||||
self.verifier_cache.clone(),
|
self.verifier_cache.clone(),
|
||||||
|
self.state_info.stratum_stats.clone(),
|
||||||
);
|
);
|
||||||
let stratum_stats = self.state_info.stratum_stats.clone();
|
|
||||||
let _ = thread::Builder::new()
|
let _ = thread::Builder::new()
|
||||||
.name("stratum_server".to_string())
|
.name("stratum_server".to_string())
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
stratum_server.run_loop(stratum_stats, edge_bits as u32, proof_size, sync_state);
|
stratum_server.run_loop(edge_bits as u32, proof_size, sync_state);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue