summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2021-09-24 09:03:44 +0200
committerGravatar Nikias Bassen2021-09-24 09:03:44 +0200
commitfa2bc21668919751be087e621cd5f327c03a78f9 (patch)
tree5b0b088abc43f3a24659db434f69077d008511e6 /src
parent8bdfec9de0cf0c839ca646d4eff9a221437b3a20 (diff)
downloadidevicerestore-fa2bc21668919751be087e621cd5f327c03a78f9.tar.gz
idevicerestore-fa2bc21668919751be087e621cd5f327c03a78f9.tar.bz2
Prevent unnecessary delay on inital device detection
Diffstat (limited to 'src')
-rw-r--r--src/idevicerestore.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index d20de69..615aa0f 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -346,11 +346,13 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
// check which mode the device is currently in so we know where to start
mutex_lock(&client->device_event_mutex);
- cond_wait_timeout(&client->device_event_cond, &client->device_event_mutex, 10000);
- if (client->mode == MODE_UNKNOWN || (client->flags & FLAG_QUIT)) {
- mutex_unlock(&client->device_event_mutex);
- error("ERROR: Unable to discover device mode. Please make sure a device is attached.\n");
- return -1;
+ if (client->mode == MODE_UNKNOWN) {
+ cond_wait_timeout(&client->device_event_cond, &client->device_event_mutex, 10000);
+ if (client->mode == MODE_UNKNOWN || (client->flags & FLAG_QUIT)) {
+ mutex_unlock(&client->device_event_mutex);
+ error("ERROR: Unable to discover device mode. Please make sure a device is attached.\n");
+ return -1;
+ }
}
idevicerestore_progress(client, RESTORE_STEP_DETECT, 0.1);
info("Found device in %s mode\n", client->mode->string);