From 9ffd2226b3931bc206e598df759b9c3f725017a8 Mon Sep 17 00:00:00 2001 From: Stephen Tramer Date: Mon, 10 Sep 2012 13:17:04 -0700 Subject: [PATCH] [BUGFIX] Avoid common output stream setup errors, including immediately scheduling the stream on a runloop. --- AFNetworking/AFURLConnectionOperation.m | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index e1c0a4b..6f4838e 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -253,6 +253,10 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat } - (void)setOutputStream:(NSOutputStream *)outputStream { + if (outputStream == _outputStream) { + return; + } + [self willChangeValueForKey:@"outputStream"]; [outputStream retain]; @@ -262,11 +266,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