Skip to content

Commit

Permalink
Throttle tunnel connection attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Sep 16, 2023
1 parent dde0373 commit ca39637
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/viser/_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,17 @@ async def connect(
],
return_when=asyncio.FIRST_COMPLETED,
)
except Exception:
except Exception as e:
pass
finally:
if local_w is not None:
local_w.close()
if remote_w is not None:
remote_w.close()

# Throttle connection attempts.
await asyncio.sleep(0.1)


if __name__ == "__main__":
tunnel = _ViserTunnel(8080)
Expand Down

0 comments on commit ca39637

Please sign in to comment.