From 2c362a775310d8d7caf29f2c396f999cc88a0233 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 17 Jul 2012 19:46:09 +0200 Subject: tss: Cycle through different hosts for TSS requests as a fallback It appears the number of HTTP requests from one IP to the TSS signing servers is limited by each signing host. This workaround increases the volume of devices that can be processed due to falling back to another signing host in case request limiting is in effect by the original host. --- src/tss.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tss.c b/src/tss.c index 98b651c..e505e6e 100644 --- a/src/tss.c +++ b/src/tss.c @@ -323,6 +323,12 @@ plist_t tss_send_request(plist_t tss_request) { unsigned int size = 0; char curl_error_message[CURL_ERROR_SIZE]; + const char* urls[3] = { + "http://gs.apple.com/TSS/controller?action=2", + "http://17.171.36.30/TSS/controller?action=2", + "http://17.151.36.30/TSS/controller?action=2" + }; + plist_to_xml(tss_request, &request, &size); tss_response* response = NULL; @@ -359,7 +365,9 @@ plist_t tss_send_request(plist_t tss_request) { if (use_apple_server==0) { curl_easy_setopt(handle, CURLOPT_URL, "http://cydia.saurik.com/TSS/controller?action=2"); } else { - curl_easy_setopt(handle, CURLOPT_URL, "http://gs.apple.com/TSS/controller?action=2"); + int url_index = (retry - 1) % 3; + curl_easy_setopt(handle, CURLOPT_URL, urls[url_index]); + info("Request URL set to %s\n", urls[url_index]); } info("Sending TSS request attempt %d... ", retry); -- cgit v1.1-32-gdbae