mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Flush socket after write
Rustls doesn't automatically flush data after write, causing deadlocks when waiting for a response.
This commit is contained in:
@@ -184,6 +184,7 @@ impl Idevice {
|
|||||||
let len = message.len() as u32;
|
let len = message.len() as u32;
|
||||||
socket.write_all(&len.to_be_bytes()).await?;
|
socket.write_all(&len.to_be_bytes()).await?;
|
||||||
socket.write_all(message.as_bytes()).await?;
|
socket.write_all(message.as_bytes()).await?;
|
||||||
|
socket.flush().await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(IdeviceError::NoEstablishedConnection)
|
Err(IdeviceError::NoEstablishedConnection)
|
||||||
@@ -233,6 +234,7 @@ impl Idevice {
|
|||||||
socket.write_all(part).await?;
|
socket.write_all(part).await?;
|
||||||
callback(((i, part_len), state.clone())).await;
|
callback(((i, part_len), state.clone())).await;
|
||||||
}
|
}
|
||||||
|
socket.flush().await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(IdeviceError::NoEstablishedConnection)
|
Err(IdeviceError::NoEstablishedConnection)
|
||||||
@@ -330,7 +332,7 @@ impl Idevice {
|
|||||||
|
|
||||||
let socket = self.socket.take().unwrap();
|
let socket = self.socket.take().unwrap();
|
||||||
let socket = connector
|
let socket = connector
|
||||||
.connect(ServerName::try_from("iOS").unwrap(), socket)
|
.connect(ServerName::try_from("Device").unwrap(), socket)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
self.socket = Some(Box::new(socket));
|
self.socket = Some(Box::new(socket));
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
use log::debug;
|
use log::debug;
|
||||||
|
|
||||||
use crate::{lockdown::LockdownClient, Idevice, IdeviceError, IdeviceService};
|
use crate::{lockdown::LockdownClient, Idevice, IdeviceError, IdeviceService};
|
||||||
|
use sha2::{Digest, Sha384};
|
||||||
|
|
||||||
#[cfg(feature = "tss")]
|
#[cfg(feature = "tss")]
|
||||||
use crate::tss::TSSRequest;
|
use crate::tss::TSSRequest;
|
||||||
@@ -539,7 +540,6 @@ impl ImageMounter {
|
|||||||
S: Clone,
|
S: Clone,
|
||||||
{
|
{
|
||||||
// Try to fetch personalization manifest
|
// Try to fetch personalization manifest
|
||||||
use sha2::{Digest, Sha384};
|
|
||||||
let mut hasher = Sha384::new();
|
let mut hasher = Sha384::new();
|
||||||
hasher.update(&image);
|
hasher.update(&image);
|
||||||
let image_hash = hasher.finalize();
|
let image_hash = hasher.finalize();
|
||||||
@@ -776,4 +776,3 @@ impl ImageMounter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user