diff options
author | Hector Martin | 2021-09-26 15:19:15 +0900 |
---|---|---|
committer | Nikias Bassen | 2021-09-27 00:46:03 +0200 |
commit | a9f8ec27f10b0f94236edcf9d2c0d23ad445e649 (patch) | |
tree | 9054bc3caba9623e1fd725fafd426932ac2a28c9 /src | |
parent | 1ea3fe75906d360c1f2ac9e6590d5b64f596f0e0 (diff) | |
download | idevicerestore-a9f8ec27f10b0f94236edcf9d2c0d23ad445e649.tar.gz idevicerestore-a9f8ec27f10b0f94236edcf9d2c0d23ad445e649.tar.bz2 |
fdr: Fix socket receive timeout handling logic
This fixes flaky restores / activation not proceeding if you're more
than 100ms away from Apple's servers.
Signed-off-by: Hector Martin <marcan@marcan.st>
Diffstat (limited to 'src')
-rw-r--r-- | src/fdr.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -593,12 +593,14 @@ static int fdr_handle_proxy_cmd(fdr_client_t fdr) } } bytes_ret = socket_receive_timeout(sockfd, buf, bufsize, 0, 100); - if (bytes_ret < 0) { - if (errno) - error("ERROR: FDR %p receiving proxy payload failed: %s\n", - fdr, strerror(errno)); - else - res = 1; /* close connection if no data with no error */ + if (bytes_ret == -ETIMEDOUT) { + bytes_ret = 0; + } else if (bytes_ret == -ECONNRESET) { + res = 1; + break; + } else if (bytes_ret < 0) { + error("ERROR: FDR %p receiving proxy payload failed: %d (%s)\n", + fdr, bytes_ret, strerror(-bytes_ret)); break; } |