Ben Copsey

Use connectionsLock when retrying a request with a new connection

@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 23
24 24
25 // Automatically set on build 25 // Automatically set on build
26 -NSString *ASIHTTPRequestVersion = @"v1.6.1-5 2010-04-01"; 26 +NSString *ASIHTTPRequestVersion = @"v1.6.1-6 2010-04-12";
27 27
28 NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain"; 28 NSString* const NetworkRequestErrorDomain = @"ASIHTTPRequestErrorDomain";
29 29
@@ -2673,9 +2673,11 @@ static BOOL isiPhoneOS2; @@ -2673,9 +2673,11 @@ static BOOL isiPhoneOS2;
2673 #if DEBUG_PERSISTENT_CONNECTIONS 2673 #if DEBUG_PERSISTENT_CONNECTIONS
2674 NSLog(@"Request attempted to use connection #%@, but it has been closed - will retry with a new connection", [[self connectionInfo] objectForKey:@"id"]); 2674 NSLog(@"Request attempted to use connection #%@, but it has been closed - will retry with a new connection", [[self connectionInfo] objectForKey:@"id"]);
2675 #endif 2675 #endif
  2676 + [connectionsLock lock];
2676 [[self connectionInfo] removeObjectForKey:@"request"]; 2677 [[self connectionInfo] removeObjectForKey:@"request"];
2677 [persistentConnectionsPool removeObject:[self connectionInfo]]; 2678 [persistentConnectionsPool removeObject:[self connectionInfo]];
2678 [self setConnectionInfo:nil]; 2679 [self setConnectionInfo:nil];
  2680 + [connectionsLock unlock];
2679 [self setRetryCount:[self retryCount]+1]; 2681 [self setRetryCount:[self retryCount]+1];
2680 [self startRequest]; 2682 [self startRequest];
2681 return YES; 2683 return YES;