update nebkor-maelstrom dep

This commit is contained in:
Joe Ardent 2024-06-05 22:12:51 -07:00
parent a49ddffa56
commit 8ada835f81
2 changed files with 4 additions and 9 deletions

4
Cargo.lock generated
View file

@ -67,9 +67,9 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]] [[package]]
name = "nebkor-maelstrom" name = "nebkor-maelstrom"
version = "0.0.1" version = "0.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83dd99cc42f1882a9a269091b25a3afb88f6237ed56bc255659e49aaf9e89fc3" checksum = "aae3eeab09bcb4f923122da7b5962b2f02fcbd7201baf45c679a6c6a258fdb11"
dependencies = [ dependencies = [
"serde", "serde",
"serde_json", "serde_json",

View file

@ -90,9 +90,6 @@ impl BCaster {
impl Node for BCaster { impl Node for BCaster {
fn handle(&mut self, runner: &Runner, req: Message) { fn handle(&mut self, runner: &Runner, req: Message) {
let typ = req.body.typ.as_str(); let typ = req.body.typ.as_str();
let frm = req.src.as_str();
let nid = runner.node_id();
let nid = nid.as_str();
match typ { match typ {
"do_gossip" => { "do_gossip" => {
@ -116,6 +113,7 @@ impl Node for BCaster {
runner.reply(&req, body); runner.reply(&req, body);
} }
"topology" => { "topology" => {
let nid = runner.node_id();
self.topology(runner.nodes(), nid); self.topology(runner.nodes(), nid);
let body = Body::from_type("topology_ok"); let body = Body::from_type("topology_ok");
runner.reply(&req, body); runner.reply(&req, body);
@ -133,10 +131,7 @@ impl Node for BCaster {
.collect::<HashSet<_>>(); .collect::<HashSet<_>>();
self.store.extend(goss.clone()); self.store.extend(goss.clone());
self.gossips self.gossips.entry(req.src).or_default().extend(goss);
.entry(frm.to_string())
.or_default()
.extend(goss);
} }
_ => { _ => {