forked from eway2012/SampleCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRetryingHTTPOperation.m
More file actions
584 lines (457 loc) · 24.7 KB
/
RetryingHTTPOperation.m
File metadata and controls
584 lines (457 loc) · 24.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
/*
File: RetryingHTTPOperation.m
Contains: Runs an HTTP request, with support for retries.
Written by: DTS
Copyright: Copyright (c) 2010 Apple Inc. All Rights Reserved.
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or
redistribution of this Apple software constitutes acceptance of
these terms. If you do not agree with these terms, please do
not use, install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following
terms, and subject to these terms, Apple grants you a personal,
non-exclusive license, under Apple's copyrights in this
original Apple software (the "Apple Software"), to use,
reproduce, modify and redistribute the Apple Software, with or
without modifications, in source and/or binary forms; provided
that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the
following text and disclaimers in all such redistributions of
the Apple Software. Neither the name, trademarks, service marks
or logos of Apple Inc. may be used to endorse or promote
products derived from the Apple Software without specific prior
written permission from Apple. Except as expressly stated in
this notice, no other rights or licenses, express or implied,
are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or
by other works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis.
APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING
THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT,
INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY
OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#import "RetryingHTTPOperation.h"
#import "NetworkManager.h"
#import "Logging.h"
#import "QHTTPOperation.h"
#import "QReachabilityOperation.h"
// When one operation completes it posts the following notification. Other operations
// listen for that notification and, if the host name matches, expedite their retry.
// This means that, if one request succeeds, subsequent requests will retry quickly.
static NSString * kRetryingHTTPOperationTransferDidSucceedNotification = @"com.apple.dts.kRetryingHTTPOperationTransferDidSucceedNotification";
static NSString * kRetryingHTTPOperationTransferDidSucceedHostKey = @"hostName";
@interface RetryingHTTPOperation ()
// read/write versions of public properties
@property (assign, readwrite) RetryingHTTPOperationState retryState;
@property (assign, readwrite) RetryingHTTPOperationState retryStateClient;
@property (assign, readwrite) BOOL hasHadRetryableFailure;
@property (assign, readwrite) NSUInteger retryCount;
@property (copy, readwrite) NSData * responseContent;
// private properties
@property (copy, readwrite) NSHTTPURLResponse * response;
@property (retain, readwrite) QHTTPOperation * networkOperation;
@property (retain, readwrite) NSTimer * retryTimer;
@property (retain, readwrite) QReachabilityOperation * reachabilityOperation;
@property (assign, readwrite) BOOL notificationInstalled;
// forward declaration
- (void)startRequest;
- (void)startReachabilityReachable:(BOOL)reachable;
- (void)startRetryAfterTimeInterval:(NSTimeInterval)delay;
@end
@implementation RetryingHTTPOperation
- (id)initWithRequest:(NSURLRequest *)request
// See comment in header.
{
assert(request != nil);
// Certain HTTP methods are idempotent, meaning that doing the request N times is
// equivalent to doing it once. As this class will automatically retry the request,
// the requests method should be idempotent lest the automatic retries cause problems.
// For example, you could imagine a situation where an automatically retried POST might
// cause a gazillion identical messages to show up on a bulletin board well site.
#if ! defined(NDEBUG)
static NSSet * sIdempotentHTTPMethods;
if (sIdempotentHTTPMethods == nil) {
@synchronized ([self class]) {
if (sIdempotentHTTPMethods == nil) {
sIdempotentHTTPMethods = [[NSSet alloc] initWithObjects:@"GET", @"HEAD", @"PUT", @"DELETE", @"OPTIONS", @"TRACE", nil];
}
}
}
assert([sIdempotentHTTPMethods containsObject:[request HTTPMethod]]);
#endif
self = [super init];
if (self != nil) {
@synchronized ([self class]) {
static NSUInteger sSequenceNumber;
self->_sequenceNumber = sSequenceNumber;
sSequenceNumber += 1;
}
self->_request = [request copy];
assert(self->_retryState == kRetryingHTTPOperationStateNotStarted);
}
return self;
}
- (void)dealloc
{
[self->_request release];
[self->_acceptableContentTypes release];
[self->_responseFilePath release];
[self->_response release];
[self->_responseContent release];
assert(self->_networkOperation == nil);
assert(self->_retryTimer == nil);
assert(self->_reachabilityOperation == nil);
[super dealloc];
}
#pragma mark * Properties
@synthesize request = _request;
- (RetryingHTTPOperationState)retryState
{
return self->_retryState;
}
- (void)setRetryState:(RetryingHTTPOperationState)newValue
// We don't really need this custom setter, but it's a great way to flush
// out redundant update problems.
{
assert([self isActualRunLoopThread]);
assert(newValue != self->_retryState);
self->_retryState = newValue;
[self performSelectorOnMainThread:@selector(syncRetryStateClient) withObject:nil waitUntilDone:NO];
}
@synthesize retryStateClient = retryStateClient;
- (void)syncRetryStateClient
// Sets the retryStateClient property on the main thread.
{
assert([NSThread isMainThread]);
self.retryStateClient = self.retryState;
}
@synthesize hasHadRetryableFailure = _hasHadRetryableFailure;
@synthesize acceptableContentTypes = _acceptableContentTypes;
@synthesize responseFilePath = _responseFilePath;
@synthesize response = _response;
@synthesize networkOperation = _networkOperation;
@synthesize retryTimer = _retryTimer;
@synthesize retryCount = _retryCount;
@synthesize reachabilityOperation = _reachabilityOperation;
@synthesize notificationInstalled = _notificationInstalled;
- (NSString *)responseMIMEType
// See comment in header.
{
NSString * result;
NSHTTPURLResponse * response;
result = nil;
response = self.response;
if (response != nil) {
result = [response MIMEType];
}
return result;
}
@synthesize responseContent = _responseContent;
#pragma mark * Utilities
- (void)setHasHadRetryableFailureOnMainThread
// Sets the hasHadRetryableFailure on the main thread.
{
assert([NSThread isMainThread]);
assert( ! self.hasHadRetryableFailure );
self.hasHadRetryableFailure = YES;
}
- (BOOL)shouldRetryAfterError:(NSError *)error
// Returns YES if the supplied error is fatal, that is, it can't be
// meaningfully retried.
{
BOOL shouldRetry;
if ( [[error domain] isEqual:kQHTTPOperationErrorDomain] ) {
// We can easily understand the consequence of coming directly from
// QHTTPOperation.
if ( [error code] > 0 ) {
// The request made it to the server, which failed it. We consider that to be
// fatal. It might make sense to handle error 503 "Service Unavailable" as a
// special case here but, realistically, how common is that?
shouldRetry = NO;
} else {
switch ( [error code] ) {
default:
assert(NO); // what is this error?
// fall through
case kQHTTPOperationErrorResponseTooLarge:
case kQHTTPOperationErrorOnOutputStream:
case kQHTTPOperationErrorBadContentType: {
shouldRetry = NO; // all of these conditions are unlikely to fail
} break;
}
}
} else {
// We treat all other errors are retryable. Most errors are likely to be from
// the network, and that's exactly what we want to retry. Clearly this is going to
// need some refinement based on real world experience.
shouldRetry = YES;
}
return shouldRetry;
}
// This isn't a crypto system, so we don't care about mod bias, so we just calculate
// the random time interval by taking the random number, mod'ing it by the number
// of milliseconds of the delay range, and then converting that number of milliseconds
// to an NSTimeInterval.
- (NSTimeInterval)retryDelayWithinRangeAtIndex:(NSUInteger)rangeIndex
// Helper method for -shortRetryDelay and -randomRetryDelay.
{
// First retry is after one second; next retry is after one minute; next retry
// is after one hour; next retry (and all subsequent retries) is after six hours.
static const NSUInteger kRetryDelays[] = { 1, 60, 60 * 60, 6 * 60 * 60 };
if (rangeIndex >= (sizeof(kRetryDelays) / sizeof(kRetryDelays[0]))) {
rangeIndex = (sizeof(kRetryDelays) / sizeof(kRetryDelays[0])) - 1;
}
return ((NSTimeInterval) (((NSUInteger) arc4random()) % (kRetryDelays[rangeIndex] * 1000))) / 1000.0;
}
- (NSTimeInterval)shortRetryDelay
// Returns a random short delay (that is, within the next second).
{
return [self retryDelayWithinRangeAtIndex:0];
}
- (NSTimeInterval)randomRetryDelay
// Returns a random delay that's based on the retryCount; the delay range grows
// rapidly with the number of retries, thereby ensuring that we don't continuously
// thrash the device doing unsuccessful retries.
{
return [self retryDelayWithinRangeAtIndex:self.retryCount];
}
#pragma mark * Core state transitions
- (void)operationDidStart
// Called by QRunLoopOperation when the operation starts. We just kick off the
// initial HTTP request.
{
assert([self isActualRunLoopThread]);
assert(self.retryState == kRetryingHTTPOperationStateNotStarted);
[super operationDidStart];
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu start %@", (size_t) self->_sequenceNumber, [self.request URL]];
self.retryState = kRetryingHTTPOperationStateGetting;
[self startRequest];
}
- (void)startRequest
// Starts the HTTP request. This might be the first request or a retry.
{
assert([self isActualRunLoopThread]);
assert( (self.retryState == kRetryingHTTPOperationStateGetting) || (self.retryState == kRetryingHTTPOperationStateRetrying) );
assert(self.networkOperation == nil);
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu request start", (size_t) self->_sequenceNumber];
// Create the network operation.
self.networkOperation = [[[QHTTPOperation alloc] initWithRequest:self.request] autorelease];
assert(self.networkOperation != nil);
// Copy our properties over to the network operation.
[self.networkOperation setQueuePriority:[self queuePriority]];
self.networkOperation.acceptableContentTypes = self.acceptableContentTypes;
self.networkOperation.runLoopThread = self.runLoopThread;
self.networkOperation.runLoopModes = self.runLoopModes;
// If we're downloading to a file, set up an output stream that points to that file.
//
// Note that we pass NO to the append parameter; if we wanted to support resumeable
// downloads, we could do it here (but we'd have to mess around with etags and so on).
if (self.responseFilePath != nil) {
self.networkOperation.responseOutputStream = [NSOutputStream outputStreamToFileAtPath:self.responseFilePath append:NO];
assert(self.networkOperation.responseOutputStream != nil);
}
[[NetworkManager sharedManager] addNetworkTransferOperation:self.networkOperation finishedTarget:self action:@selector(networkOperationDone:)];
}
- (void)networkOperationDone:(QHTTPOperation *)operation
// Called when the network operation finishes. We look at the error to decide how to proceed.
{
assert([self isActualRunLoopThread]);
assert( (self.retryState == kRetryingHTTPOperationStateGetting) || (self.retryState == kRetryingHTTPOperationStateRetrying) );
assert(operation == self.networkOperation);
self.networkOperation = nil;
if (operation.error == nil) {
// The request was successful; let's complete the operation.
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu request success", (size_t) self->_sequenceNumber];
self.response = operation.lastResponse;
self.responseContent = operation.responseBody;
[self finishWithError:nil]; // this changes state to kRetryingHTTPOperationStateFinished
} else {
// Something went wrong. Deal with the error.
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu request error %@", (size_t) self->_sequenceNumber, operation.error];
if ( ! [self shouldRetryAfterError:operation.error] ) {
// If the error is fatal, we just fail the overall operation.
[self finishWithError:operation.error];
} else {
// If this is our first retry, tell our client that we are in retry mode.
if (self.retryState == kRetryingHTTPOperationStateGetting) {
[self performSelectorOnMainThread:@selector(setHasHadRetryableFailureOnMainThread) withObject:nil waitUntilDone:NO];
}
// If our notification callback isn't installed, install it.
//
// This notification is broadcast if any download succeeds. If it fires, we
// trigger a very quick retry because, if one transfer succeeds, it's likely that
// other transfers will succeed as well.
if ( ! self.notificationInstalled ) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(transferDidSucceed:) name:kRetryingHTTPOperationTransferDidSucceedNotification object:nil];
self.notificationInstalled = YES;
}
// If the reachability operation is not running (this can happen the first time we fail
// and if a subsequent reachability-based retry fails), start it up. Given that reachability
// only tells us about the state of our local machine, the operation could have failed for
// reasons that reachability knows nothing about. So before we use a reachability
// check to trigger a retry, we want to make sure that the host is first /unreachable/,
// and then wait for it to become reachability. So, let's start with that first part.
if (self.reachabilityOperation == nil) {
[self startReachabilityReachable:NO];
}
// Start a time-based retry.
self.retryState = kRetryingHTTPOperationStateWaitingToRetry;
[self startRetryAfterTimeInterval:[self randomRetryDelay]];
}
}
}
- (void)transferDidSucceed:(NSNotification *)note
// Called when kRetryingHTTPOperationTransferDidSucceedNotification is posted.
// We see if this notification is relevant to us and, if so, pass it on to code
// running on our run loop.
{
// Can't look at state at this point, but it is safe to look at request because
// that's immutable.
assert( [[note name] isEqual:kRetryingHTTPOperationTransferDidSucceedNotification] );
assert( [[[note userInfo] objectForKey:kRetryingHTTPOperationTransferDidSucceedHostKey] isKindOfClass:[NSString class]] );
// If the successful transfer was to /our/ host, we pass the notification off to
// our run loop thread.
if ( [[[note userInfo] objectForKey:kRetryingHTTPOperationTransferDidSucceedHostKey] isEqual:[[self.request URL] host]] ) {
// This raises the question of what happens if the operation changes state (most critically,
// if it finishes) while waiting for this selector to be performed. It turns out that's OK.
// The perform will retain self while it's in flight, and if it is delivered in an inappropriate
// context (after, say, the operation has finished), it will be ignored based on the retryState.
[self performSelector:@selector(transferDidSucceedOnRunLoopThread) onThread:self.actualRunLoopThread withObject:nil waitUntilDone:NO];
}
}
- (void)transferDidSucceedOnRunLoopThread
// Called on our run loop when a kRetryingHTTPOperationTransferDidSucceedNotification
// notification relevant to us is posted. We check whether a fast retry is in order.
{
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu other transfer succeeeded", (size_t) self->_sequenceNumber];
// If some other transfer to the same host succeeded, radically reduce our retry delay.
if (self.retryState == kRetryingHTTPOperationStateWaitingToRetry) {
assert(self.retryTimer != nil);
[self.retryTimer invalidate];
self.retryTimer = nil;
[self startRetryAfterTimeInterval:[self shortRetryDelay]];
}
}
- (void)startRetryAfterTimeInterval:(NSTimeInterval)delay
// Schedules a retry to occur after the specified delay.
{
assert(self.retryState == kRetryingHTTPOperationStateWaitingToRetry);
assert(self.retryTimer == nil);
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu retry wait start %.3f", (size_t) self->_sequenceNumber, delay];
self.retryTimer = [NSTimer timerWithTimeInterval:delay target:self selector:@selector(retryTimerDone:) userInfo:nil repeats:NO];
assert(self.retryTimer != nil);
for (NSString * mode in self.actualRunLoopModes) {
[[NSRunLoop currentRunLoop] addTimer:self.retryTimer forMode:mode];
}
}
- (void)retryTimerDone:(NSTimer *)timer
// Called when the retry timer expires. It just starts the actual retry.
{
assert([self isActualRunLoopThread]);
assert(timer == self.retryTimer);
#pragma unused(timer)
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu retry wait done", (size_t) self->_sequenceNumber];
[self.retryTimer invalidate];
self.retryTimer = nil;
assert(self.retryState == kRetryingHTTPOperationStateWaitingToRetry);
self.retryState = kRetryingHTTPOperationStateRetrying;
self.retryCount += 1;
[self startRequest];
}
- (void)startReachabilityReachable:(BOOL)reachable
// Starts a reachability operation waiting for the host associated with this request
// to become unreachable or reachabel (depending on the "reachable" parameter).
{
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu %sreachable start", (size_t) self->_sequenceNumber, reachable ? "" : "un" ];
assert(self.reachabilityOperation == nil);
self.reachabilityOperation = [[[QReachabilityOperation alloc] initWithHostName:[[self.request URL] host]] autorelease];
assert(self.reachabilityOperation != nil);
// In the reachable case the default mask and value is fine. In the unreachable case
// we have to customise them.
if ( ! reachable ) {
self.reachabilityOperation.flagsTargetMask = kSCNetworkReachabilityFlagsReachable;
self.reachabilityOperation.flagsTargetValue = 0;
}
[self.reachabilityOperation setQueuePriority:[self queuePriority]];
self.reachabilityOperation.runLoopThread = self.runLoopThread;
self.reachabilityOperation.runLoopModes = self.runLoopModes;
[[NetworkManager sharedManager] addNetworkManagementOperation:self.reachabilityOperation finishedTarget:self action:@selector(reachabilityOperationDone:)];
}
- (void)reachabilityOperationDone:(QReachabilityOperation *)operation
// Called when the reachability operation finishes. If we were looking for the
// host to become unreachable, we respond by scheduling a new operation waiting
// for the host to become reachable. OTOH, if we've found that the host has
// become reachable (and this must be a transition because we only schedule
// such an operation if the host is current unreachable), we force a fast retry.
{
assert([self isActualRunLoopThread]);
assert(self.retryState >= kRetryingHTTPOperationStateWaitingToRetry);
assert(operation == self.reachabilityOperation);
self.reachabilityOperation = nil;
assert(operation.error == nil); // ReachabilityOperation can never actually fail
if ( ! (operation.flags & kSCNetworkReachabilityFlagsReachable) ) {
// We've know that the host is not unreachable. Schedule a reachability operation to
// wait for it to become reachable.
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu unreachable done (0x%zx)", (size_t) self->_sequenceNumber, (size_t) operation.flags];
[self startReachabilityReachable:YES];
} else {
// Reachability has flipped from being unreachable to being reachable. We respond by
// radically shortening the retry delay (although not too short, we want to give the
// system time to settle after the reachability change).
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu reachable done (0x%zx)", (size_t) self->_sequenceNumber, (size_t) operation.flags];
if (self.retryState == kRetryingHTTPOperationStateWaitingToRetry) {
assert(self.retryTimer != nil);
[self.retryTimer invalidate];
self.retryTimer = nil;
[self startRetryAfterTimeInterval:[self shortRetryDelay] + 3.0];
}
}
}
- (void)operationWillFinish
// Called by QRunLoopOperation when the operation finishes. We just clean up
// our various operations and callbacks.
{
assert([self isActualRunLoopThread]);
[super operationWillFinish];
if (self.networkOperation != nil) {
[[NetworkManager sharedManager] cancelOperation:self.networkOperation];
self.networkOperation = nil;
}
if (self.retryTimer != nil) {
[self.retryTimer invalidate];
self.retryTimer = nil;
}
if (self.reachabilityOperation != nil) {
[[NetworkManager sharedManager] cancelOperation:self.reachabilityOperation];
self.reachabilityOperation = nil;
}
if (self.notificationInstalled) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kRetryingHTTPOperationTransferDidSucceedNotification object:nil];
self.notificationInstalled = NO;
}
self.retryState = kRetryingHTTPOperationStateFinished;
if (self.error == nil) {
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu success", (size_t) self->_sequenceNumber];
// We were successful. Broadcast a notification to that effect so that other transfers who
// are delayed waiting to retry know that now is a good time.
[[NSNotificationCenter defaultCenter] postNotificationName:kRetryingHTTPOperationTransferDidSucceedNotification
object:nil
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[[self.request URL] host], kRetryingHTTPOperationTransferDidSucceedHostKey, nil]
];
} else {
[[QLog log] logOption:kLogOptionNetworkDetails withFormat:@"http %zu error %@", (size_t) self->_sequenceNumber, self.error];
}
}
@end