Minor reformatting
This commit is contained in:
parent
6fc8b0a971
commit
f63a70fa27
1 changed files with 6 additions and 9 deletions
|
|
@ -1071,9 +1071,10 @@ static const NSUInteger AFMultipartBodyStreamProviderDefaultBufferLength = 4096;
|
||||||
|
|
||||||
#pragma mark - NSStreamDelegate
|
#pragma mark - NSStreamDelegate
|
||||||
|
|
||||||
/**
|
|
||||||
This retry works around a nasty problem in which mutli-part uploads will fail due to the stream delegate being sent a `NSStreamEventHasSpaceAvailable` event before the input stream has finished opening. This workaround simply replays the event after allowing the run-loop to cycle, providing enough time for the input stream to finish opening. It appears that this bug is in the CFNetwork layer. (See https://github.com/AFNetworking/AFNetworking/issues/948)
|
// This retry works around a nasty problem in which mutli-part uploads will fail due to the stream delegate being sent a `NSStreamEventHasSpaceAvailable` event before the input stream has finished opening.
|
||||||
*/
|
// This workaround simply replays the event after allowing the run-loop to cycle, providing enough time for the input stream to finish opening. It appears that this bug is in the CFNetwork layer.
|
||||||
|
// See: https://github.com/AFNetworking/AFNetworking/issues/948
|
||||||
- (void)retryWrite:(NSStream *)stream {
|
- (void)retryWrite:(NSStream *)stream {
|
||||||
[self stream:stream handleEvent:NSStreamEventHasSpaceAvailable];
|
[self stream:stream handleEvent:NSStreamEventHasSpaceAvailable];
|
||||||
}
|
}
|
||||||
|
|
@ -1082,7 +1083,6 @@ static const NSUInteger AFMultipartBodyStreamProviderDefaultBufferLength = 4096;
|
||||||
handleEvent:(NSStreamEvent)eventCode {
|
handleEvent:(NSStreamEvent)eventCode {
|
||||||
if (eventCode & NSStreamEventHasSpaceAvailable) {
|
if (eventCode & NSStreamEventHasSpaceAvailable) {
|
||||||
if (self.inputStream.streamStatus < NSStreamStatusOpen) {
|
if (self.inputStream.streamStatus < NSStreamStatusOpen) {
|
||||||
// See comments in `retryWrite:` for details
|
|
||||||
[self performSelector:@selector(retryWrite:) withObject:stream afterDelay:0.1];
|
[self performSelector:@selector(retryWrite:) withObject:stream afterDelay:0.1];
|
||||||
} else {
|
} else {
|
||||||
[self handleOutputStreamSpaceAvailable];
|
[self handleOutputStreamSpaceAvailable];
|
||||||
|
|
@ -1140,11 +1140,8 @@ static const NSUInteger AFMultipartBodyStreamProviderDefaultBufferLength = 4096;
|
||||||
[outputStream close];
|
[outputStream close];
|
||||||
outputStream.delegate = nil;
|
outputStream.delegate = nil;
|
||||||
|
|
||||||
/*
|
// Workaround for a race condition in CFStream _CFStreamCopyRunLoopsAndModes. This outputstream needs to be retained just a little longer.
|
||||||
Workaround for a race condition in CFStream _CFStreamCopyRunLoopsAndModes. This outputstream needs to be retained just a little longer.
|
// See: https://github.com/AFNetworking/AFNetworking/issues/907
|
||||||
|
|
||||||
See: https://github.com/AFNetworking/AFNetworking/issues/907
|
|
||||||
*/
|
|
||||||
NSTimeInterval delay = 2.0;
|
NSTimeInterval delay = 2.0;
|
||||||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC));
|
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC));
|
||||||
dispatch_after(popTime, dispatch_get_main_queue(), ^{
|
dispatch_after(popTime, dispatch_get_main_queue(), ^{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue