MCPcopy
hub / github.com/sshuttle/sshuttle / expire_connections

Function expire_connections

sshuttle/client.py:474–494  ·  view source on GitHub ↗
(now, mux)

Source from the content-addressed store, hash-verified

472
473
474def expire_connections(now, mux):
475 remove = []
476 for chan, timeout in dnsreqs.items():
477 if timeout < now:
478 debug3('expiring dnsreqs channel=%d' % chan)
479 remove.append(chan)
480 del mux.channels[chan]
481 for chan in remove:
482 del dnsreqs[chan]
483 debug3('Remaining DNS requests: %d' % len(dnsreqs))
484
485 remove = []
486 for peer, (chan, timeout) in udp_by_src.items():
487 if timeout < now:
488 debug3('expiring UDP channel channel=%d peer=%r' % (chan, peer))
489 mux.send(chan, ssnet.CMD_UDP_CLOSE, b'')
490 remove.append(peer)
491 del mux.channels[chan]
492 for peer in remove:
493 del udp_by_src[peer]
494 debug3('Remaining UDP channels: %d' % len(udp_by_src))
495
496
497def onaccept_tcp(listener, method, mux, handlers):

Callers 3

onaccept_tcpFunction · 0.85
onaccept_udpFunction · 0.85
ondnsFunction · 0.85

Calls 2

debug3Function · 0.90
sendMethod · 0.45

Tested by

no test coverage detected