[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 {
|
} else {
|
||||||
if ([[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length] > 0) {
|
if ([[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length] > 0) {
|
||||||
self.outputStream = [NSOutputStream outputStreamToMemory];
|
self.outputStream = [NSOutputStream outputStreamToMemory];
|
||||||
|
|
||||||
|
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||||
|
for (NSString *runLoopMode in self.runLoopModes) {
|
||||||
|
[self.outputStream scheduleInRunLoop:runLoop forMode:runLoopMode];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,11 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
self.request = urlRequest;
|
self.request = urlRequest;
|
||||||
|
|
||||||
self.outputStream = [NSOutputStream outputStreamToMemory];
|
self.outputStream = [NSOutputStream outputStreamToMemory];
|
||||||
|
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||||
|
for (NSString *runLoopMode in self.runLoopModes) {
|
||||||
|
[self.outputStream scheduleInRunLoop:runLoop forMode:runLoopMode];
|
||||||
|
}
|
||||||
|
|
||||||
self.state = AFOperationReadyState;
|
self.state = AFOperationReadyState;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
@ -253,6 +257,10 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setOutputStream:(NSOutputStream *)outputStream {
|
- (void)setOutputStream:(NSOutputStream *)outputStream {
|
||||||
|
if (_outputStream == outputStream) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
[self willChangeValueForKey:@"outputStream"];
|
[self willChangeValueForKey:@"outputStream"];
|
||||||
[outputStream retain];
|
[outputStream retain];
|
||||||
|
|
||||||
|
|
@ -262,11 +270,6 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
}
|
}
|
||||||
_outputStream = outputStream;
|
_outputStream = outputStream;
|
||||||
[self didChangeValueForKey:@"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
|
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue