Skip to content

Commit

Permalink
Merge pull request pokeb#245 from mbelshe/master
Browse files Browse the repository at this point in the history
Small fix to the bandwidth throttler.
  • Loading branch information
pokeb committed Aug 20, 2011
2 parents a879b8e + 8783cbc commit 1a7ae81
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Classes/ASIInputStream.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)len
}
[request performThrottling];
}
[ASIHTTPRequest incrementBandwidthUsedInLastSecond:toRead];
[readLock unlock];
return [stream read:buffer maxLength:toRead];
NSInteger rv = [stream read:buffer maxLength:toRead];
if (rv > 0)
[ASIHTTPRequest incrementBandwidthUsedInLastSecond:rv];
return rv;
}

/*
Expand Down

0 comments on commit 1a7ae81

Please sign in to comment.