Applying equivalent patch for 4c20a5ea38a50f119c9e8ac3d91fb199192a1d57, which fixes potential non-terminating loop in connection:didReceiveData:

This commit is contained in:
Mattt Thompson 2014-04-15 13:20:56 -07:00
parent b3d44e2fc3
commit e7bc1679c7

View file

@ -739,16 +739,20 @@ didReceiveResponse:(NSURLResponse *)response
while (totalNumberOfBytesWritten < length) {
numberOfBytesWritten = [self.outputStream write:&dataBuffer[0] maxLength:length];
if (numberOfBytesWritten == -1) {
[self.connection cancel];
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:self.outputStream.streamError];
return;
} else {
totalNumberOfBytesWritten += numberOfBytesWritten;
break;
}
totalNumberOfBytesWritten += numberOfBytesWritten;
}
break;
}
if (self.outputStream.streamError) {
[self.connection cancel];
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:self.outputStream.streamError];
return;
}
}
dispatch_async(dispatch_get_main_queue(), ^{