[Issue #507] Fixing potential issues with output stream runloop scheduling
This commit is contained in:
parent
40c73c6588
commit
a4508ac997
2 changed files with 14 additions and 6 deletions
|
|
@ -314,6 +314,11 @@ didReceiveResponse:(NSURLResponse *)response
|
|||
} else {
|
||||
if ([[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length] > 0) {
|
||||
self.outputStream = [NSOutputStream outputStreamToMemory];
|
||||
|
||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||
for (NSString *runLoopMode in self.runLoopModes) {
|
||||
[self.outputStream scheduleInRunLoop:runLoop forMode:runLoopMode];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,6 +179,10 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
|||
self.request = urlRequest;
|
||||
|
||||
self.outputStream = [NSOutputStream outputStreamToMemory];
|
||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||
for (NSString *runLoopMode in self.runLoopModes) {
|
||||
[self.outputStream scheduleInRunLoop:runLoop forMode:runLoopMode];
|
||||
}
|
||||
|
||||
self.state = AFOperationReadyState;
|
||||
|
||||
|
|
@ -253,6 +257,10 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
|||
}
|
||||
|
||||
- (void)setOutputStream:(NSOutputStream *)outputStream {
|
||||
if (_outputStream == outputStream) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self willChangeValueForKey:@"outputStream"];
|
||||
[outputStream retain];
|
||||
|
||||
|
|
@ -262,11 +270,6 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
|||
}
|
||||
_outputStream = outputStream;
|
||||
[self didChangeValueForKey:@"outputStream"];
|
||||
|
||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||
for (NSString *runLoopMode in self.runLoopModes) {
|
||||
[self.outputStream scheduleInRunLoop:runLoop forMode:runLoopMode];
|
||||
}
|
||||
}
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue