Example #1
0
 def write(self, data):
     if self.throttle:
         ThrottlingProtocol.write(self, data)
         if self.stats:
             self.stats.sentBytes(len(data))
     else:
         ProtocolWrapper.write(self, data)
Example #2
0
 def writeSequence(self, seq):
     if self.throttle:
         ThrottlingProtocol.writeSequence(self, seq)
         if self.stats:
             self.stats.sentBytes(reduce(operator.add, map(len, seq)))
     else:
         ProtocolWrapper.writeSequence(self, seq)
Example #3
0
 def writeSequence(self, seq):
     if self.throttle:
         ThrottlingProtocol.writeSequence(self, seq)
         if self.stats:
             self.stats.sentBytes(reduce(operator.add, map(len, seq)))
     else:
         ProtocolWrapper.writeSequence(self, seq)
Example #4
0
 def write(self, data):
     if self.throttle:
         ThrottlingProtocol.write(self, data)
         if self.stats:
             self.stats.sentBytes(len(data))
     else:
         ProtocolWrapper.write(self, data)
Example #5
0
 def registerProducer(self, producer, streaming):
     ThrottlingProtocol.registerProducer(self, producer, streaming)
     streamType = getattr(producer, 'stream', None)
     if isinstance(streamType, UploadStream):
         self.throttle = True
Example #6
0
 def __init__(self, factory, wrappedProtocol):
     ThrottlingProtocol.__init__(self, factory, wrappedProtocol)
     self.throttle = False
Example #7
0
 def registerProducer(self, producer, streaming):
     ThrottlingProtocol.registerProducer(self, producer, streaming)
     streamType = getattr(producer, 'stream', None)
     if isinstance(streamType, UploadStream):
         self.throttle = True
Example #8
0
 def __init__(self, factory, wrappedProtocol):
     ThrottlingProtocol.__init__(self, factory, wrappedProtocol)
     self.throttle = False