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