Skip to content

Commit

Permalink
starting supporting for message memorial sealing messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
SurfingNerd committed Mar 23, 2022
1 parent 4eb3593 commit 9152921
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/ethcore/src/engines/hbbft/hbbft_message_memorium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,27 @@ impl HbbftMessageDispatcher {
}
}

pub fn on_sealing_message_received(&mut self, message: &sealing::Message, epoch: u64) {

self.ensure_worker_thread();
}


pub fn on_message_received(&mut self , message: &HbMessage) {
//performance: dispatcher pattern + multithreading could improve performance a lot.

let mut memorial = self.memorial.write();

let mut lock = memorial.dispatched_messages.write();

// ok, expensive memory copy...
// but probably better than using (weak) arcs in all the other code.
lock.push_back(message.clone());
//self.sender.send(message.clone());

self.ensure_worker_thread();
}

fn ensure_worker_thread(&mut self) {

if self.thread.is_none() {
// let mut memo = self;
Expand Down

0 comments on commit 9152921

Please sign in to comment.