(self)
| 48 | return self.speed |
| 49 | |
| 50 | def resetChunkSize(self): |
| 51 | with self.lock: |
| 52 | # power of two smaller or equal to speed limit |
| 53 | try: |
| 54 | self.chunkSize = int(math.pow(2, int(math.log(self.limit,2)))) |
| 55 | except ValueError: |
| 56 | self.chunkSize = Throttle.maxChunkSize |
| 57 | # range check |
| 58 | if self.chunkSize < Throttle.minChunkSize: |
| 59 | self.chunkSize = Throttle.minChunkSize |
| 60 | elif self.chunkSize > Throttle.maxChunkSize: |
| 61 | self.chunkSize = Throttle.maxChunkSize |
| 62 | |
| 63 | @Singleton |
| 64 | class SendThrottle(Throttle): |
no test coverage detected