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:
Generated
+1
@@ -894,6 +894,7 @@ dependencies = [
|
||||
"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_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]]
|
||||
|
||||
@@ -24,6 +24,7 @@ serde_json = "1"
|
||||
chrono = "0.4.4"
|
||||
bufstream = "~0.1"
|
||||
jsonrpc-core = "~8.0"
|
||||
tokio = "0.1.11"
|
||||
|
||||
grin_api = { path = "../api", version = "1.0.1" }
|
||||
grin_chain = { path = "../chain", version = "1.0.1" }
|
||||
|
||||
@@ -302,12 +302,12 @@ impl Server {
|
||||
self.chain.clone(),
|
||||
self.tx_pool.clone(),
|
||||
self.verifier_cache.clone(),
|
||||
self.state_info.stratum_stats.clone(),
|
||||
);
|
||||
let stratum_stats = self.state_info.stratum_stats.clone();
|
||||
let _ = thread::Builder::new()
|
||||
.name("stratum_server".to_string())
|
||||
.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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+578
-512
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user