(self, data)
See IStreamConsumer
See IStreamConsumer
See IStreamConsumer
def received(self, data):
        'See IStreamConsumer'
        rm = self.remain
        if rm < 1:
            self.completed = True # Avoid any chance of spinning
            return 0
        datalen = len(data)
        if rm <= datalen:
            self.buf.append(data[:rm])
            self.remain = 0
            self.completed = True
            return rm
        else:
            self.buf.append(data)
            self.remain -= datalen
            return datalen
def received ( self , data ) : rm = self . remain if rm < 1 : self . completed = True # Avoid any chance of spinning return 0 datalen = len ( data ) if rm <= datalen : self . buf . append ( data [ : rm ] ) self . remain = 0 self . completed = True return rm else : self . buf . append ( data ) self . remain -= datalen return datalen