| 387 | self.too_full = True |
| 388 | |
| 389 | def send(self, channel, cmd, data): |
| 390 | assert isinstance(data, bytes) |
| 391 | assert len(data) <= 65535 |
| 392 | p = struct.pack('!ccHHH', b('S'), b('S'), channel, cmd, len(data)) \ |
| 393 | + data |
| 394 | self.outbuf.append(p) |
| 395 | debug2(' > channel=%d cmd=%s len=%d (fullness=%d)' |
| 396 | % (channel, cmd_to_name.get(cmd, hex(cmd)), |
| 397 | len(data), self.fullness)) |
| 398 | # debug3('>>> data: %r' % data) |
| 399 | self.fullness += len(data) |
| 400 | |
| 401 | def got_packet(self, channel, cmd, data): |
| 402 | debug2('< channel=%d cmd=%s len=%d' |