Merge pull request #245 from mbelshe/master
Small fix to the bandwidth throttler.
Showing
1 changed file
with
4 additions
and
2 deletions
@@ -58,9 +58,11 @@ static NSLock *readLock = nil; | @@ -58,9 +58,11 @@ static NSLock *readLock = nil; | ||
58 | } | 58 | } |
59 | [request performThrottling]; | 59 | [request performThrottling]; |
60 | } | 60 | } |
61 | - [ASIHTTPRequest incrementBandwidthUsedInLastSecond:toRead]; | ||
62 | [readLock unlock]; | 61 | [readLock unlock]; |
63 | - return [stream read:buffer maxLength:toRead]; | 62 | + NSInteger rv = [stream read:buffer maxLength:toRead]; |
63 | + if (rv > 0) | ||
64 | + [ASIHTTPRequest incrementBandwidthUsedInLastSecond:rv]; | ||
65 | + return rv; | ||
64 | } | 66 | } |
65 | 67 | ||
66 | /* | 68 | /* |
-
Please register or login to post a comment