From 9cd5551156cd297a4cf1d26450ca82b4dac29ad8 Mon Sep 17 00:00:00 2001 From: Frans-Willem Hardijzer Date: Fri, 1 Dec 2023 13:40:45 +0100 Subject: [PATCH] Properly handle response of TALK command, such that receive buffer doesn't fill up. If receive buffer fills up, neolink will never exit as the response to TALK_STOP will not get handled correctly. --- crates/core/src/bc_protocol/talk.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/core/src/bc_protocol/talk.rs b/crates/core/src/bc_protocol/talk.rs index df787ab..785ba66 100644 --- a/crates/core/src/bc_protocol/talk.rs +++ b/crates/core/src/bc_protocol/talk.rs @@ -323,7 +323,7 @@ impl BcCamera { let full_block_size = block_size + 4; // Block size + predictor state let msg_num = self.new_message_num(); - let sub = connection.subscribe(MSG_ID_TALK, msg_num).await?; + let mut sub = connection.subscribe(MSG_ID_TALK, msg_num).await?; const BLOCK_PER_PAYLOAD: usize = 1; const BLOCK_HEADER_SIZE: usize = 4; @@ -398,6 +398,7 @@ impl BcCamera { }; sub.send(msg).await?; + let _ = sub.recv().await?; std::thread::sleep(std::time::Duration::from_secs_f32(play_length * 0.95)); }