diff --git a/cove-tui/src/euph/conn.rs b/cove-tui/src/euph/conn.rs index 9f35179..4600781 100644 --- a/cove-tui/src/euph/conn.rs +++ b/cove-tui/src/euph/conn.rs @@ -161,7 +161,7 @@ struct State { impl State { async fn run( ws: WsStream, - tx_canary: oneshot::Receiver, + mut tx_canary: mpsc::UnboundedReceiver, rx_canary: oneshot::Receiver, event_tx: mpsc::UnboundedSender, mut event_rx: mpsc::UnboundedReceiver, @@ -181,7 +181,7 @@ impl State { }; select! { - _ = tx_canary => (), + _ = tx_canary.recv() => (), _ = rx_canary => (), _ = Self::listen(&mut ws_rx, &event_tx) => (), _ = Self::send_ping_events(&event_tx) => (), @@ -357,8 +357,9 @@ impl State { } } +#[derive(Debug, Clone)] pub struct ConnTx { - canary: oneshot::Sender, + canary: mpsc::UnboundedSender, event_tx: mpsc::UnboundedSender, } @@ -398,6 +399,7 @@ impl ConnTx { } } +#[derive(Debug)] pub struct ConnRx { canary: oneshot::Sender, packet_rx: mpsc::UnboundedReceiver, @@ -412,7 +414,7 @@ impl ConnRx { // TODO Combine ConnTx and ConnRx and implement Stream + Sink? pub fn wrap(ws: WsStream) -> (ConnTx, ConnRx) { - let (tx_canary_tx, tx_canary_rx) = oneshot::channel(); + let (tx_canary_tx, tx_canary_rx) = mpsc::unbounded_channel(); let (rx_canary_tx, rx_canary_rx) = oneshot::channel(); let (event_tx, event_rx) = mpsc::unbounded_channel(); let (packet_tx, packet_rx) = mpsc::unbounded_channel();