1
0
Fork 0
mirror of https://git.wownero.com/wownero/tippero.git synced 2024-08-15 00:33:14 +00:00

Some more tweaking of the flood protection code

This commit is contained in:
moneromooo 2015-01-01 12:45:59 +00:00
parent abb67ef06f
commit ce3c69b339

View file

@ -23,7 +23,7 @@ irc_line_delay = 0
irc = None irc = None
sslirc = None sslirc = None
irc_password = "" irc_password = ""
irc_min_send_delay = 0.01 # seconds irc_min_send_delay = 0.05 # seconds
irc_max_send_delay = 5 # seconds irc_max_send_delay = 5 # seconds
last_ping_time = time.time() last_ping_time = time.time()
@ -48,9 +48,12 @@ def SendIRC(msg):
if current_send_delay > irc_max_send_delay: if current_send_delay > irc_max_send_delay:
current_send_delay = irc_max_send_delay current_send_delay = irc_max_send_delay
else: else:
current_send_delay = current_send_delay / 1.5 while dt > current_send_delay * 1.5:
if current_send_delay < irc_min_send_delay: dt = dt - current_send_delay
current_send_delay = irc_min_send_delay current_send_delay = current_send_delay / 1.5
if current_send_delay < irc_min_send_delay:
current_send_delay = irc_min_send_delay
break
log_IRCSEND(msg) log_IRCSEND(msg)
irc_send(msg + '\r\n') irc_send(msg + '\r\n')