Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #5
0
 def registerProducer(self, producer, streaming):
     ThrottlingProtocol.registerProducer(self, producer, streaming)
     streamType = getattr(producer, 'stream', None)
     if isinstance(streamType, UploadStream):
         self.throttle = True
Exemple #6
0
 def __init__(self, factory, wrappedProtocol):
     ThrottlingProtocol.__init__(self, factory, wrappedProtocol)
     self.throttle = False
Exemple #7
0
 def registerProducer(self, producer, streaming):
     ThrottlingProtocol.registerProducer(self, producer, streaming)
     streamType = getattr(producer, 'stream', None)
     if isinstance(streamType, UploadStream):
         self.throttle = True
Exemple #8
0
 def __init__(self, factory, wrappedProtocol):
     ThrottlingProtocol.__init__(self, factory, wrappedProtocol)
     self.throttle = False