Applying equivalent patch for 4c20a5ea38a50f119c9e8ac3d91fb199192a1d57, which fixes potential non-terminating loop in connection:didReceiveData:
This commit is contained in:
parent
b3d44e2fc3
commit
e7bc1679c7
1 changed files with 9 additions and 5 deletions
|
|
@ -739,16 +739,20 @@ didReceiveResponse:(NSURLResponse *)response
|
||||||
while (totalNumberOfBytesWritten < length) {
|
while (totalNumberOfBytesWritten < length) {
|
||||||
numberOfBytesWritten = [self.outputStream write:&dataBuffer[0] maxLength:length];
|
numberOfBytesWritten = [self.outputStream write:&dataBuffer[0] maxLength:length];
|
||||||
if (numberOfBytesWritten == -1) {
|
if (numberOfBytesWritten == -1) {
|
||||||
[self.connection cancel];
|
break;
|
||||||
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:self.outputStream.streamError];
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
totalNumberOfBytesWritten += numberOfBytesWritten;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalNumberOfBytesWritten += numberOfBytesWritten;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
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(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue