Permalink
Browse files

Use recursive bandwidth throttling lock to avoid deadlock. Fixes issue

  • Loading branch information...
alleus authored and jonkean committed May 11, 2012
1 parent 57ae5be commit abcfaede92a65c8d753f460468de304458de5d51
Showing with 2 additions and 2 deletions.
  1. +2 −2 Classes/ASIHTTPRequest.m
View
@@ -89,7 +89,7 @@ static void ReadStreamClientCallBack(CFReadStreamRef readStream, CFStreamEventTy
static NSDate *bandwidthMeasurementDate = nil;
// Since throttling variables are shared among all requests, we'll use a lock to mediate access
-static NSLock *bandwidthThrottlingLock = nil;
+static NSRecursiveLock *bandwidthThrottlingLock = nil;
// the maximum number of bytes that can be transmitted in one second
static unsigned long maxBandwidthPerSecond = 0;
@@ -259,7 +259,7 @@ + (void)initialize
persistentConnectionsPool = [[NSMutableArray alloc] init];
connectionsLock = [[NSRecursiveLock alloc] init];
progressLock = [[NSRecursiveLock alloc] init];
- bandwidthThrottlingLock = [[NSLock alloc] init];
+ bandwidthThrottlingLock = [[NSRecursiveLock alloc] init];
sessionCookiesLock = [[NSRecursiveLock alloc] init];
sessionCredentialsLock = [[NSRecursiveLock alloc] init];
delegateAuthenticationLock = [[NSRecursiveLock alloc] init];

0 comments on commit abcfaed

Please sign in to comment.