Browse Source

Merge #559

559: Make sure not to fail in for loop sending to takers r=da-kami a=da-kami



Co-authored-by: Daniel Karzel <daniel@comit.network>
new-http-api
bors[bot] 3 years ago
committed by GitHub
parent
commit
3337c6ae3e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      daemon/src/maker_inc_connections.rs

13
daemon/src/maker_inc_connections.rs

@ -157,9 +157,16 @@ impl Actor {
async fn handle_broadcast_order(&mut self, msg: BroadcastOrder) -> Result<()> {
let order = msg.0;
for (taker_id, conn) in self.write_connections.clone() {
tracing::trace!(%taker_id, "sending new order for broadcast to connection: {:?}", order);
conn.do_send_async(wire::MakerToTaker::CurrentOrder(order.clone()))
.await?;
if conn
.do_send_async(wire::MakerToTaker::CurrentOrder(order.clone()))
.await
.is_err()
{
tracing::trace!(%taker_id, "removing outdated connection to taker because unable to send order: {:?}", order);
self.write_connections.remove(&taker_id);
} else {
tracing::trace!(%taker_id, "sent new order: {:?}", order);
}
}
Ok(())
}

Loading…
Cancel
Save