Flush after socket write

This commit is contained in:
Jackson Coxson
2025-05-26 16:01:47 -06:00
parent fa88c2c87d
commit f6cc68cb98
2 changed files with 5 additions and 0 deletions

View File

@@ -114,6 +114,7 @@ impl<R: ReadWrite> DebugProxyClient<R> {
// Send the packet
self.socket.write_all(packet.as_bytes()).await?;
self.socket.flush().await?;
// Read the response
let response = self.read_response().await?;
@@ -173,6 +174,7 @@ impl<R: ReadWrite> DebugProxyClient<R> {
/// Returns `IdeviceError` if writing fails
pub async fn send_raw(&mut self, bytes: &[u8]) -> Result<(), IdeviceError> {
self.socket.write_all(bytes).await?;
self.socket.flush().await?;
Ok(())
}
@@ -254,6 +256,7 @@ impl<R: ReadWrite> DebugProxyClient<R> {
/// Returns `IdeviceError` if writing fails
pub async fn send_ack(&mut self) -> Result<(), IdeviceError> {
self.socket.write_all(b"+").await?;
self.socket.flush().await?;
Ok(())
}
@@ -263,6 +266,7 @@ impl<R: ReadWrite> DebugProxyClient<R> {
/// Returns `IdeviceError` if writing fails
pub async fn send_noack(&mut self) -> Result<(), IdeviceError> {
self.socket.write_all(b"-").await?;
self.socket.flush().await?;
Ok(())
}

View File

@@ -202,6 +202,7 @@ impl<R: ReadWrite> RemoteServerClient<R> {
let message = Message::new(mheader, pheader, aux, data);
debug!("Sending message: {message:#?}");
self.idevice.write_all(&message.serialize()).await?;
self.idevice.flush().await?;
Ok(())
}