Browse files

Auto-retry on 'broken pipe' error

  • Loading branch information...
1 parent 1e87370 commit ca7178eb2a5e2142f4581fb2fd62fc188d9bb06e @pokeb committed Mar 23, 2010
Showing with 4 additions and 3 deletions.
  1. +4 −3 Classes/ASIHTTPRequest.m
View
7 Classes/ASIHTTPRequest.m
@@ -23,7 +23,7 @@
// Automatically set on build
-NSString *ASIHTTPRequestVersion = @"v1.6-18 2010-03-22";
+NSString *ASIHTTPRequestVersion = @"v1.6-19 2010-03-22";
NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain";
@@ -2689,12 +2689,13 @@ - (void)handleStreamError
if (![self error]) { // We may already have handled this error
- // First, check for a 'socket not connected' or 'connection lost' error
+ // First, check for a 'socket not connected', 'broken pipe' or 'connection lost' error
// This may occur when we've attempted to reuse a connection that should have been closed
// If we get this, we need to retry the request
// We'll only do this once - if it happens again on retry, we'll give up
// -1005 = kCFURLErrorNetworkConnectionLost - this doesn't seem to be declared on Mac OS 10.5
- if (([[underlyingError domain] isEqualToString:NSPOSIXErrorDomain] && [underlyingError code] == ENOTCONN) || ([[underlyingError domain] isEqualToString:(NSString *)kCFErrorDomainCFNetwork] && [underlyingError code] == -1005)) {
+ if (([[underlyingError domain] isEqualToString:NSPOSIXErrorDomain] && ([underlyingError code] == ENOTCONN || [underlyingError code] == EPIPE))
+ || ([[underlyingError domain] isEqualToString:(NSString *)kCFErrorDomainCFNetwork] && [underlyingError code] == -1005)) {
if ([self retryUsingNewConnection]) {
return;
}

0 comments on commit ca7178e

Please sign in to comment.