Skip to content

Commit

Permalink
Merge branch 'master' into close-on-err
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 10, 2020
2 parents 3c35c5d + 93a11a8 commit 6b49527
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions broker/src/tunneldigger_broker/broker.py
Expand Up @@ -102,11 +102,12 @@ def create_tunnel(self, broker, address, uuid, remote_tunnel_id, client_features
# Check if they are all within "time".
delta = now - tunnelCollection[0] # Delta of oldest timestamp in collection and now
if delta <= self.connection_rate_limit_per_ip_time:
logger.info("Rejecting tunnel {0} due to per-IP rate limiting: {1} attempts in {2} seconds".format(
logger.info(
"Rejecting tunnel %s due to per-IP rate limiting: %d attempts in %d seconds",
tunnel_str,
len(tunnelCollection),
int(delta),
))
)
broker.hook_manager.run_hook(
'broker.connection-rate-limit',
address[0],
Expand All @@ -123,9 +124,10 @@ def create_tunnel(self, broker, address, uuid, remote_tunnel_id, client_features
try:
tunnel_id = self.tunnel_ids.pop()
except KeyError:
logger.warning("No more tunnel IDs available -- %d active tunnels", self.tunnels)
return False

logger.info("Creating tunnel %s with id %d." % (tunnel_str, tunnel_id))
logger.info("Creating tunnel %s with id %d.", tunnel_str, tunnel_id)

try:
tunnel = td_tunnel.Tunnel(
Expand Down

0 comments on commit 6b49527

Please sign in to comment.