mirror of https://github.com/dirtbags/moth.git
Handle flooding
This commit is contained in:
parent
689bff487c
commit
de6a455ebc
10
game.py
10
game.py
|
@ -224,11 +224,8 @@ class Player(asynchat.async_chat):
|
|||
def err(self, msg):
|
||||
self._write_val(['ERR', msg])
|
||||
|
||||
def win(self, flag=False):
|
||||
val = ['WIN']
|
||||
if flag:
|
||||
val.append('You have the flag')
|
||||
self._write_val(val)
|
||||
def win(self):
|
||||
self._write_val(['WIN'])
|
||||
self.unblock()
|
||||
|
||||
def lose(self):
|
||||
|
@ -237,6 +234,9 @@ class Player(asynchat.async_chat):
|
|||
|
||||
def collect_incoming_data(self, data):
|
||||
self.inbuf.append(data)
|
||||
if len(self.inbuf) > 10:
|
||||
self.err('Too much data, punk.')
|
||||
self.close()
|
||||
|
||||
def found_terminator(self):
|
||||
self.last_activity = time.time()
|
||||
|
|
Loading…
Reference in New Issue