| 313 | |
| 314 | class Mux(Handler): |
| 315 | def __init__(self, rsock, wsock): |
| 316 | Handler.__init__(self, [rsock, wsock]) |
| 317 | self.rsock = rsock |
| 318 | self.wsock = wsock |
| 319 | self.new_channel = self.got_dns_req = self.got_routes = None |
| 320 | self.got_host_req = self.got_host_list = None |
| 321 | self.channels = {} |
| 322 | self.chani = 0 |
| 323 | self.want = 0 |
| 324 | self.inbuf = '' |
| 325 | self.outbuf = [] |
| 326 | self.fullness = 0 |
| 327 | self.too_full = False |
| 328 | self.send(0, CMD_PING, 'chicken') |
| 329 | |
| 330 | def next_channel(self): |
| 331 | # channel 0 is special, so we never allocate it |