Close connection after 40 bad action

This commit is contained in:
shortcutme 2017-01-05 02:25:16 +01:00
parent ee0176e730
commit 889c88c492

View file

@ -78,6 +78,11 @@ class Connection(object):
def badAction(self, weight=1): def badAction(self, weight=1):
self.bad_actions += weight self.bad_actions += weight
if self.bad_actions > 40:
self.close()
elif self.bad_actions > 20:
time.sleep(5)
def goodAction(self): def goodAction(self):
self.bad_actions = 0 self.bad_actions = 0