Skip to content
Snippets Groups Projects
Commit 7c0daaa1 authored by Hugo Trentesaux's avatar Hugo Trentesaux Committed by Éloïs
Browse files

wip nothing

parent a040f44f
Branches
No related tags found
No related merge requests found
...@@ -271,6 +271,7 @@ impl BlockchainModule { ...@@ -271,6 +271,7 @@ impl BlockchainModule {
if let Some(_sync_opts) = sync_opts { if let Some(_sync_opts) = sync_opts {
// TODO ... // TODO ...
// take into account sync options
} else { } else {
// Start main loop // Start main loop
self.main_loop(blockchain_receiver); self.main_loop(blockchain_receiver);
......
...@@ -103,7 +103,7 @@ pub struct WS2POutgoingOrchestrator<WS: WebsocketTrait> { ...@@ -103,7 +103,7 @@ pub struct WS2POutgoingOrchestrator<WS: WebsocketTrait> {
heads: HashMap<NodeFullId, NetworkHead>, heads: HashMap<NodeFullId, NetworkHead>,
/// List of established connections /// List of established connections
connections: HashMap<WS2PControllerId, OutgoingConnection>, connections: HashMap<WS2PControllerId, OutgoingConnection>,
/// List of endpoinds whose last connection attempt failed /// List of endpoints whose last connection attempt failed
endpoints_in_error: HashMap<NodeFullId, EndpointInError>, endpoints_in_error: HashMap<NodeFullId, EndpointInError>,
/// List of endpoints that have never been contacted /// List of endpoints that have never been contacted
never_try_endpoints: Vec<EndpointEnum>, never_try_endpoints: Vec<EndpointEnum>,
...@@ -202,7 +202,7 @@ impl<WS: WebsocketTrait> WS2POutgoingOrchestrator<WS> { ...@@ -202,7 +202,7 @@ impl<WS: WebsocketTrait> WS2POutgoingOrchestrator<WS> {
// Request CurrentBlockstamp and Milestones (always necessary) // Request CurrentBlockstamp and Milestones (always necessary)
self.request_current_blockstamp(); self.request_current_blockstamp();
self.request_milestones(); self.request_milestones();
// TODO retreive local peer on creation // TODO retrieve local peer on creation
// if in sync mode // if in sync mode
if let Some(sync_opt) = sync_opt { if let Some(sync_opt) = sync_opt {
......
...@@ -158,13 +158,15 @@ impl NetworkModule<DuRsConf, DursMsg> for WS2PModule { ...@@ -158,13 +158,15 @@ impl NetworkModule<DuRsConf, DursMsg> for WS2PModule {
if let Ok((mut outgoing_orchestrator, mut orchestrator)) = init(keys, router_sender) { if let Ok((mut outgoing_orchestrator, mut orchestrator)) = init(keys, router_sender) {
// starts listening module messages // starts listening module messages
thread::spawn(move || { thread::spawn(move || {
debug!("started orchestrator thread");
orchestrator.main_loop(); orchestrator.main_loop();
}); });
// starts outgoing in sync mode // starts outgoing in sync mode
thread::spawn(move || { thread::spawn(move || {
debug!("started outgoing orchestrator thread");
outgoing_orchestrator.main_loop(Some(sync_params)); outgoing_orchestrator.main_loop(Some(sync_params));
}); });
// return Ok if no error occured // return Ok if no error occurred
Ok(()) Ok(())
} else { } else {
fatal_error!("failed to init orchestrator"); fatal_error!("failed to init orchestrator");
...@@ -241,7 +243,7 @@ impl DursModule<DuRsConf, DursMsg> for WS2PModule { ...@@ -241,7 +243,7 @@ impl DursModule<DuRsConf, DursMsg> for WS2PModule {
thread::spawn(move || { thread::spawn(move || {
outgoing_orchestrator.main_loop(None); outgoing_orchestrator.main_loop(None);
}); });
// return Ok if no error occured // return Ok if no error occurred
Ok(()) Ok(())
} else { } else {
fatal_error!("failed to init orchestrator"); fatal_error!("failed to init orchestrator");
...@@ -276,7 +278,7 @@ fn init( ...@@ -276,7 +278,7 @@ fn init(
// generate peer card // generate peer card
let peer_card = if let Ok(peer_card) = generate_peer::_generate_self_peer( let peer_card = if let Ok(peer_card) = generate_peer::_generate_self_peer(
CurrencyName("mok".to_string()), CurrencyName("mok".to_string()), // TODO get currency name
key_pair, key_pair,
node_id, node_id,
BlockNumber(0), // yet unknown TODO replace when known BlockNumber(0), // yet unknown TODO replace when known
...@@ -305,6 +307,8 @@ fn init( ...@@ -305,6 +307,8 @@ fn init(
self_node.clone(), self_node.clone(),
); );
debug!("initialized orchestrators");
// return the orchestrators in order to start their main loop in separate threads // return the orchestrators in order to start their main loop in separate threads
Ok((outgoing_orchestrator, orchestrator)) Ok((outgoing_orchestrator, orchestrator))
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment