(listener, method, mux, handlers)
| 539 | |
| 540 | |
| 541 | def onaccept_udp(listener, method, mux, handlers): |
| 542 | now = time.time() |
| 543 | t = method.recv_udp(listener, 4096) |
| 544 | if t is None: |
| 545 | return |
| 546 | srcip, dstip, data = t |
| 547 | debug1('Accept UDP: %r -> %r.' % (srcip, dstip,)) |
| 548 | if srcip in udp_by_src: |
| 549 | chan, _ = udp_by_src[srcip] |
| 550 | else: |
| 551 | chan = mux.next_channel() |
| 552 | mux.channels[chan] = lambda cmd, data: udp_done( |
| 553 | chan, data, method, listener, dstip=srcip) |
| 554 | mux.send(chan, ssnet.CMD_UDP_OPEN, b"%d" % listener.family) |
| 555 | udp_by_src[srcip] = chan, now + 30 |
| 556 | |
| 557 | hdr = b"%s,%d," % (dstip[0].encode("ASCII"), dstip[1]) |
| 558 | mux.send(chan, ssnet.CMD_UDP_DATA, hdr + data) |
| 559 | |
| 560 | expire_connections(now, mux) |
| 561 | |
| 562 | |
| 563 | def dns_done(chan, data, method, sock, srcip, dstip, mux): |
nothing calls this directly
no test coverage detected