summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Hector Martin2021-09-26 15:19:15 +0900
committerGravatar Nikias Bassen2021-09-27 00:46:03 +0200
commita9f8ec27f10b0f94236edcf9d2c0d23ad445e649 (patch)
tree9054bc3caba9623e1fd725fafd426932ac2a28c9 /src
parent1ea3fe75906d360c1f2ac9e6590d5b64f596f0e0 (diff)
downloadidevicerestore-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.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/fdr.c b/src/fdr.c
index ff7b56e..e3703fe 100644
--- a/src/fdr.c
+++ b/src/fdr.c
@@ -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;
}