From b47c271ec001b63e9bdcacc65d7b2b3b2761989b Mon Sep 17 00:00:00 2001 From: Ultradesu Date: Fri, 24 Jul 2026 01:18:02 +0300 Subject: [PATCH] Connected Devices: fix stream finish --- src/devices.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/devices.rs b/src/devices.rs index 649aab0..c082c3a 100644 --- a/src/devices.rs +++ b/src/devices.rs @@ -406,6 +406,7 @@ impl DeviceSync { }, ) .await?; + finish_send(&mut stream).await?; let response = read_msg(&mut stream).await?; match response { WireMessage::PairResponse { @@ -599,6 +600,7 @@ impl DeviceSync { }, ) .await?; + finish_send(&mut stream).await?; match read_msg(&mut stream).await? { WireMessage::SyncResponse { accepted: true, @@ -1608,6 +1610,7 @@ async fn handle_pair_request( }, ) .await?; + finish_send(&mut stream).await?; return Ok(()); } profile.endpoint_id = stream.peer_id.to_string(); @@ -1655,6 +1658,7 @@ async fn handle_pair_request( }, ) .await?; + finish_send(&mut stream).await?; return Ok(()); } @@ -1691,6 +1695,7 @@ async fn handle_pair_request( }, ) .await?; + finish_send(&mut stream).await?; Ok(()) } @@ -1720,6 +1725,7 @@ async fn handle_hello( }, ) .await?; + finish_send(&mut stream).await?; return Ok(()); } if !is_active_trusted(&sync, &profile.device_id)? { @@ -1735,6 +1741,7 @@ async fn handle_hello( }, ) .await?; + finish_send(&mut stream).await?; return Ok(()); } profile.endpoint_id = stream.peer_id.to_string(); @@ -1768,6 +1775,7 @@ async fn handle_hello( }, ) .await?; + finish_send(&mut stream).await?; sync.gc_tombstones()?; Ok(()) } @@ -2048,6 +2056,11 @@ async fn write_msg(stream: &mut ByteStream, message: &WireMessage) -> Result<()> Ok(()) } +async fn finish_send(stream: &mut ByteStream) -> Result<()> { + stream.send.finish()?; + Ok(()) +} + async fn read_msg(stream: &mut ByteStream) -> Result { let line = read_line(&mut stream.recv).await?; Ok(serde_json::from_slice(&line)?)