[BUGFIX] Avoid common output stream setup errors, including immediately scheduling the stream on a runloop.
This commit is contained in:
parent
c0d7e11449
commit
9ffd2226b3
1 changed files with 4 additions and 5 deletions
|
|
@ -253,6 +253,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 +266,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