mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-01-05 21:48:54 +01:00
parent
bea723c598
commit
4fdd715bc1
@ -277,18 +277,25 @@ udp_by_src = {}
|
||||
|
||||
|
||||
def expire_connections(now, mux):
|
||||
remove = []
|
||||
for chan, timeout in dnsreqs.items():
|
||||
if timeout < now:
|
||||
debug3('expiring dnsreqs channel=%d\n' % chan)
|
||||
remove.append(chan)
|
||||
del mux.channels[chan]
|
||||
del dnsreqs[chan]
|
||||
for chan in remove:
|
||||
del dnsreqs[chan]
|
||||
debug3('Remaining DNS requests: %d\n' % len(dnsreqs))
|
||||
|
||||
remove = []
|
||||
for peer, (chan, timeout) in udp_by_src.items():
|
||||
if timeout < now:
|
||||
debug3('expiring UDP channel channel=%d peer=%r\n' % (chan, peer))
|
||||
mux.send(chan, ssnet.CMD_UDP_CLOSE, '')
|
||||
remove.append(peer)
|
||||
del mux.channels[chan]
|
||||
del udp_by_src[peer]
|
||||
for peer in remove:
|
||||
del udp_by_src[peer]
|
||||
debug3('Remaining UDP channels: %d\n' % len(udp_by_src))
|
||||
|
||||
|
||||
|
@ -328,14 +328,20 @@ def main(latency_control):
|
||||
|
||||
if dnshandlers:
|
||||
now = time.time()
|
||||
for channel, h in list(dnshandlers.items()):
|
||||
remove = []
|
||||
for channel, h in dnshandlers.items():
|
||||
if h.timeout < now or not h.ok:
|
||||
debug3('expiring dnsreqs channel=%d\n' % channel)
|
||||
del dnshandlers[channel]
|
||||
remove.append(channel)
|
||||
h.ok = False
|
||||
for channel in remove:
|
||||
del dnshandlers[channel]
|
||||
if udphandlers:
|
||||
for channel, h in list(udphandlers.items()):
|
||||
remove = []
|
||||
for channel, h in udphandlers.items():
|
||||
if not h.ok:
|
||||
debug3('expiring UDP channel=%d\n' % channel)
|
||||
del udphandlers[channel]
|
||||
remove.append(channel)
|
||||
h.ok = False
|
||||
for channel in remove:
|
||||
del udphandlers[channel]
|
||||
|
Loading…
Reference in New Issue
Block a user