Replace the send() with do_send() method the prevent being stuck
This commit is contained in:
parent
b2e9c6b27a
commit
82f2d49dc6
1 changed files with 7 additions and 2 deletions
|
@ -60,7 +60,9 @@ impl Handler<DisconnectController> for AppState {
|
||||||
err
|
err
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
block_on(address.send(ControllerWsAction::Disconnect))??;
|
// TODO: why does the block_on(send()) version not return? The AppState will be stuck.
|
||||||
|
//block_on(address.send(ControllerWsAction::Disconnect))??;
|
||||||
|
address.do_send(ControllerWsAction::Disconnect);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -84,7 +86,10 @@ impl Handler<Action> for AppState {
|
||||||
fn handle(&mut self, msg: Action, _ctx: &mut Self::Context) -> Self::Result {
|
fn handle(&mut self, msg: Action, _ctx: &mut Self::Context) -> Self::Result {
|
||||||
log::debug!("Forwarding action: {:?}", msg.action);
|
log::debug!("Forwarding action: {:?}", msg.action);
|
||||||
if let Some((_, address)) = self.connected_controllers.get(&msg.controller_uid) {
|
if let Some((_, address)) = self.connected_controllers.get(&msg.controller_uid) {
|
||||||
block_on(address.send(msg.action))?
|
// TODO: why does the block_on(send()) version not return? The AppState will be stuck.
|
||||||
|
//block_on(address.send(msg.action))?
|
||||||
|
address.do_send(msg.action);
|
||||||
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(EmgauwaError::Connection(msg.controller_uid))
|
Err(EmgauwaError::Connection(msg.controller_uid))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue