Skip to content

Commit

Permalink
Fixed potential division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Dec 25, 2023
1 parent f4de5d5 commit d67c8eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions RNS/Interfaces/Interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__(self):
self.txb = 0
self.created = time.time()
self.online = False
self.bitrate = 1e6

self.ingress_control = True
self.ic_max_held_announces = Interface.MAX_HELD_ANNOUNCES
Expand Down
2 changes: 1 addition & 1 deletion RNS/Transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ def packet_sent(packet):
interface.announce_queue = []

queued_announces = True if len(interface.announce_queue) > 0 else False
if not queued_announces and outbound_time > interface.announce_allowed_at:
if not queued_announces and outbound_time > interface.announce_allowed_at and interface.bitrate != None and interface.bitrate != 0:
tx_time = (len(packet.raw)*8) / interface.bitrate
wait_time = (tx_time / interface.announce_cap)
interface.announce_allowed_at = outbound_time + wait_time
Expand Down

0 comments on commit d67c8eb

Please sign in to comment.