From b89639ad47adf0e773e4287a9cde25daa946f428 Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Sun, 6 Apr 2025 23:19:23 -0600 Subject: [PATCH] Flush socket after write Rustls doesn't automatically flush data after write, causing deadlocks when waiting for a response. --- idevice/src/lib.rs | 4 +++- idevice/src/mobile_image_mounter.rs | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/idevice/src/lib.rs b/idevice/src/lib.rs index 58a6159..f82f1d0 100644 --- a/idevice/src/lib.rs +++ b/idevice/src/lib.rs @@ -184,6 +184,7 @@ impl Idevice { let len = message.len() as u32; socket.write_all(&len.to_be_bytes()).await?; socket.write_all(message.as_bytes()).await?; + socket.flush().await?; Ok(()) } else { Err(IdeviceError::NoEstablishedConnection) @@ -233,6 +234,7 @@ impl Idevice { socket.write_all(part).await?; callback(((i, part_len), state.clone())).await; } + socket.flush().await?; Ok(()) } else { Err(IdeviceError::NoEstablishedConnection) @@ -330,7 +332,7 @@ impl Idevice { let socket = self.socket.take().unwrap(); let socket = connector - .connect(ServerName::try_from("iOS").unwrap(), socket) + .connect(ServerName::try_from("Device").unwrap(), socket) .await?; self.socket = Some(Box::new(socket)); diff --git a/idevice/src/mobile_image_mounter.rs b/idevice/src/mobile_image_mounter.rs index ad9e906..57fc6f1 100644 --- a/idevice/src/mobile_image_mounter.rs +++ b/idevice/src/mobile_image_mounter.rs @@ -10,6 +10,7 @@ use log::debug; use crate::{lockdown::LockdownClient, Idevice, IdeviceError, IdeviceService}; +use sha2::{Digest, Sha384}; #[cfg(feature = "tss")] use crate::tss::TSSRequest; @@ -539,7 +540,6 @@ impl ImageMounter { S: Clone, { // Try to fetch personalization manifest - use sha2::{Digest, Sha384}; let mut hasher = Sha384::new(); hasher.update(&image); let image_hash = hasher.finalize(); @@ -776,4 +776,3 @@ impl ImageMounter { } } } -