Close connection after 40 bad action
This commit is contained in:
parent
ee0176e730
commit
889c88c492
1 changed files with 5 additions and 0 deletions
|
@ -78,6 +78,11 @@ class Connection(object):
|
|||
|
||||
def badAction(self, weight=1):
|
||||
self.bad_actions += weight
|
||||
if self.bad_actions > 40:
|
||||
self.close()
|
||||
elif self.bad_actions > 20:
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
def goodAction(self):
|
||||
self.bad_actions = 0
|
||||
|
|
Loading…
Reference in a new issue