Skip to content

Commit

Permalink
Merge pull request pokeb#258 from leereilly/master
Browse files Browse the repository at this point in the history
bandwith / bandwidth issue
  • Loading branch information
pokeb committed Sep 17, 2011
2 parents 90e5fbc + e1604d1 commit 29a1571
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Classes/ASIHTTPRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static void ReadStreamClientCallBack(CFReadStreamRef readStream, CFStreamEventTy

// When YES, bandwidth will be automatically throttled when using WWAN (3G/Edge/GPRS)
// Wifi will not be throttled
static BOOL shouldThrottleBandwithForWWANOnly = NO;
static BOOL shouldThrottleBandwidthForWWANOnly = NO;
#endif

// Mediates access to the session cookies so requests
Expand Down Expand Up @@ -4493,7 +4493,7 @@ + (BOOL)isBandwidthThrottled
#if TARGET_OS_IPHONE
[bandwidthThrottlingLock lock];

BOOL throttle = isBandwidthThrottled || (!shouldThrottleBandwithForWWANOnly && (maxBandwidthPerSecond > 0));
BOOL throttle = isBandwidthThrottled || (!shouldThrottleBandwidthForWWANOnly && (maxBandwidthPerSecond > 0));
[bandwidthThrottlingLock unlock];
return throttle;
#else
Expand Down Expand Up @@ -4573,7 +4573,7 @@ + (void)measureBandwidthUsage
// Are we performing bandwidth throttling?
if (
#if TARGET_OS_IPHONE
isBandwidthThrottled || (!shouldThrottleBandwithForWWANOnly && (maxBandwidthPerSecond))
isBandwidthThrottled || (!shouldThrottleBandwidthForWWANOnly && (maxBandwidthPerSecond))
#else
maxBandwidthPerSecond
#endif
Expand Down Expand Up @@ -4625,15 +4625,15 @@ + (void)setShouldThrottleBandwidthForWWAN:(BOOL)throttle
[ASIHTTPRequest setMaxBandwidthPerSecond:0];
[bandwidthThrottlingLock lock];
isBandwidthThrottled = NO;
shouldThrottleBandwithForWWANOnly = NO;
shouldThrottleBandwidthForWWANOnly = NO;
[bandwidthThrottlingLock unlock];
}
}

+ (void)throttleBandwidthForWWANUsingLimit:(unsigned long)limit
{
[bandwidthThrottlingLock lock];
shouldThrottleBandwithForWWANOnly = YES;
shouldThrottleBandwidthForWWANOnly = YES;
maxBandwidthPerSecond = limit;
[ASIHTTPRequest registerForNetworkReachabilityNotifications];
[bandwidthThrottlingLock unlock];
Expand Down

0 comments on commit 29a1571

Please sign in to comment.