Skip to content

Commit

Permalink
fix: properly handle tcpapps that don't have any actions
Browse files Browse the repository at this point in the history
  • Loading branch information
amokfa committed Nov 20, 2024
1 parent 0a03ee1 commit 56df577
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion uplink/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uplink"
version = "2.14.1"
version = "2.16.1"
authors = ["tekjar <[email protected]>"]
edition = "2021"

Expand Down
4 changes: 3 additions & 1 deletion uplink/src/collector/tcpjson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ struct ClientConnection {

impl ClientConnection {
pub async fn start(&mut self, mut client: Framed<TcpStream, LinesCodec>) -> anyhow::Result<()> {
let (_dummy_action_tx, dummy_action_rx) = flume::bounded(0);
let actions_rx = self.actions_rx.as_ref().unwrap_or_else(|| &dummy_action_rx);
loop {
select! {
line = client.next() => {
Expand All @@ -120,7 +122,7 @@ impl ClientConnection {
error!("Error handling incoming line = {e}, app = {}", self.app_name);
}
}
action = self.actions_rx.as_ref().unwrap().recv_async(), if self.actions_rx.is_some() => {
action = actions_rx.recv_async() => {
let action = action?;
if action.name == "cancel_action" {
if !self.supports_cancellation {
Expand Down

0 comments on commit 56df577

Please sign in to comment.