Gossip glomers: Async Rust code too slow for 3b?

I am trying my hand on the 3b challenge, doing async Rust. I am getting these messages:

java.lang.AssertionError: Assert failed: Invalid dest for message #maelstrom.net.message.Message{:id 9, :src "n3", :dest "c1", :body {:type "init_ok", :in_reply_to 1}}
(get queues (:dest m))

If I am running this challenge with the code from 3a (synchronous Rust), everything works fine (except of course the values are not getting propagated). My Rust code is here:

What I am doing is basically starting 4 different threads, and communicate via channels between them. Even without the channels (earlier version), and doing everything in main, I am getting these error messages when switching from sync to async.

Any insight would be appreciated :slight_smile:

And here are the logs, which shows that I clearly answer each message:

2023-05-15 07:54:33 - INFO: read_from_stdin:: Message { src: "c1", dest: "n2", body: Init { msg_id: 1, node_id: "n2", node_ids: ["n0", "n1", "n2", "n3", "n4"] } }
2023-05-15 07:54:33 - INFO: read_from_stdin:: Message { src: "c2", dest: "n0", body: Init { msg_id: 1, node_id: "n0", node_ids: ["n0", "n1", "n2", "n3", "n4"] } }
2023-05-15 07:54:33 - INFO: write to stdout:: "{\"src\":\"n2\",\"dest\":\"c1\",\"body\":{\"type\":\"init_ok\",\"in_reply_to\":1}}"
2023-05-15 07:54:33 - INFO: write to stdout:: "{\"src\":\"n0\",\"dest\":\"c2\",\"body\":{\"type\":\"init_ok\",\"in_reply_to\":1}}"
2023-05-15 07:54:33 - INFO: read_from_stdin:: Message { src: "c4", dest: "n3", body: Init { msg_id: 1, node_id: "n3", node_ids: ["n0", "n1", "n2", "n3", "n4"] } }
2023-05-15 07:54:33 - INFO: write to stdout:: "{\"src\":\"n3\",\"dest\":\"c4\",\"body\":{\"type\":\"init_ok\",\"in_reply_to\":1}}"
2023-05-15 07:54:33 - INFO: read_from_stdin:: Message { src: "c0", dest: "n4", body: Init { msg_id: 1, node_id: "n4", node_ids: ["n0", "n1", "n2", "n3", "n4"] } }
2023-05-15 07:54:33 - INFO: write to stdout:: "{\"src\":\"n4\",\"dest\":\"c0\",\"body\":{\"type\":\"init_ok\",\"in_reply_to\":1}}"
2023-05-15 07:54:33 - INFO: read_from_stdin:: Message { src: "c3", dest: "n1", body: Init { msg_id: 1, node_id: "n1", node_ids: ["n0", "n1", "n2", "n3", "n4"] } }
2023-05-15 07:54:33 - INFO: write to stdout:: "{\"src\":\"n1\",\"dest\":\"c3\",\"body\":{\"type\":\"init_ok\",\"in_reply_to\":1}}"

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.