-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Hello,
I'm experiencing ADB protocol-level errors that suggest the TCP stream gets out of sync:
* respones used 2561394801 for our local_id instead of 90260985
* got CLSE in respone instead of OKAY
* got WRTE in respone instead of OKAY
I'm running ADB commands simultaneously on multiple Android emulators, where each ADBTcpDevice instance connects to exactly one emulator. Once these errors occur, retrying commands on the same connection continues to fail with similar protocol mismatches.
Example code:
fn capture_framebuffer(device: &Arc<Mutex<ADBTcpDevice>>) -> ImageBuffer<Rgba<u8>, Vec<u8>> {
loop {
match device.lock().unwrap().framebuffer_inner() {
Ok(framebuffer) => return framebuffer,
Err(e) => {
error!("Failed to capture framebuffer: {}. Retrying...", e);
sleep(Duration::from_millis(500));
}
}
}
}After the first error, all retries fail with errors mentioned above. Each device has its own Arc<Mutex<ADBTcpDevice>> with only one thread using it, so this isn't a concurrency issue on my end.
Question:
What's the best way to handle this? Should the library recover automatically, or do I need to recreate the device connection when these errors occur? There doesn't seem to be a way to reset the session state on an existing connection.