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