diff options
author | Martin Szulecki | 2010-07-09 23:32:43 +0200 |
---|---|---|
committer | Martin Szulecki | 2010-07-09 23:32:43 +0200 |
commit | 333b7b972a52162de00940dfa75a2cbd87efd9de (patch) | |
tree | 24d22e960f0605c9004cfed570673d2268a16692 /src/asr.c | |
parent | 4ac94fe7a174f841b13734f98d237a8afac6cbab (diff) | |
download | idevicerestore-333b7b972a52162de00940dfa75a2cbd87efd9de.tar.gz idevicerestore-333b7b972a52162de00940dfa75a2cbd87efd9de.tar.bz2 |
Try five times to retrieve validation plist if it failed
This fixes hanging as the following payload message is not received
initially but after polling the second time.
Diffstat (limited to 'src/asr.c')
-rw-r--r-- | src/asr.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -137,6 +137,7 @@ int asr_perform_validation(idevice_connection_t asr, const char* filesystem) { plist_t packet = NULL; plist_t packet_info = NULL; plist_t payload_info = NULL; + int attempts = 0; file = fopen(filesystem, "rb"); if (file == NULL) { @@ -172,6 +173,17 @@ int asr_perform_validation(idevice_connection_t asr, const char* filesystem) { return -1; } + if (packet == NULL) { + if (attempts < 5) { + info("Retrying to receive validation packet... %d\n", attempts); + attempts++; + sleep(1); + continue; + } + } + + attempts = 0; + node = plist_dict_get_item(packet, "Command"); if (!node || plist_get_node_type(node) != PLIST_STRING) { error("ERROR: Unable to find command node in validation request\n"); @@ -181,10 +193,7 @@ int asr_perform_validation(idevice_connection_t asr, const char* filesystem) { if (!strcmp(command, "OOBData")) { asr_handle_oob_data_request(asr, packet, file); - - plist_free(packet); - } else if(!strcmp(command, "Payload")) { plist_free(packet); break; |