Browse Source

Transition uses of `do_send` to `send`

`do_send` on `MessageChannel` suffers from the same problems as
`Address#do_send` and `Address#do_send_async`.

Our uses only send messages that never fail so we don't need to adjust
anything.
reconnect-to-maker
Thomas Eizinger 3 years ago
parent
commit
07ebb08606
No known key found for this signature in database GPG Key ID: 651AC83A6C6C8B96
  1. 9
      daemon/src/fan_out.rs
  2. 18
      daemon/src/taker_cfd.rs

9
daemon/src/fan_out.rs

@ -22,11 +22,10 @@ where
{
async fn handle(&mut self, message: M, _: &mut xtra::Context<Self>) {
for receiver in &self.receivers {
// Not sure why here is no `do_send_async` ...
if receiver.do_send(message.clone()).is_err() {
tracing::error!(
"Fan out actor was unable to send to other actor - we should never see this."
)
if receiver.send(message.clone()).await.is_err() {
// Should ideally remove from list but that is unnecessarily hard with Rust
// iterators
tracing::error!("Actor disconnected, cannot send message");
}
}
}

18
daemon/src/taker_cfd.rs

@ -167,7 +167,8 @@ impl<O, M, W> Actor<O, M, W> {
self.order_feed_actor_inbox.send(None)?;
self.send_to_maker
.do_send(wire::TakerToMaker::TakeOrder { order_id, quantity })?;
.send(wire::TakerToMaker::TakeOrder { order_id, quantity })
.await?;
Ok(())
}
@ -221,13 +222,14 @@ where
self.send_pending_update_proposals()?;
self.send_to_maker
.do_send(wire::TakerToMaker::ProposeSettlement {
.send(wire::TakerToMaker::ProposeSettlement {
order_id: proposal.order_id,
timestamp: proposal.timestamp,
taker: proposal.taker,
maker: proposal.maker,
price: proposal.price,
})?;
})
.await?;
Ok(())
}
@ -381,10 +383,11 @@ where
self.send_pending_update_proposals()?;
self.send_to_maker
.do_send(wire::TakerToMaker::ProposeRollOver {
.send(wire::TakerToMaker::ProposeRollOver {
order_id: proposal.order_id,
timestamp: proposal.timestamp,
})?;
})
.await?;
Ok(())
}
}
@ -667,10 +670,11 @@ where
let (tx, sig_taker) = dlc.close_transaction(proposal)?;
self.send_to_maker
.do_send(wire::TakerToMaker::InitiateSettlement {
.send(wire::TakerToMaker::InitiateSettlement {
order_id,
sig_taker,
})?;
})
.await?;
cfd.handle(CfdStateChangeEvent::ProposalSigned(
CollaborativeSettlement::new(

Loading…
Cancel
Save