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):
|
def err(self, msg):
|
||||||
self._write_val(['ERR', msg])
|
self._write_val(['ERR', msg])
|
||||||
|
|
||||||
def win(self, flag=False):
|
def win(self):
|
||||||
val = ['WIN']
|
self._write_val(['WIN'])
|
||||||
if flag:
|
|
||||||
val.append('You have the flag')
|
|
||||||
self._write_val(val)
|
|
||||||
self.unblock()
|
self.unblock()
|
||||||
|
|
||||||
def lose(self):
|
def lose(self):
|
||||||
|
@ -237,6 +234,9 @@ class Player(asynchat.async_chat):
|
||||||
|
|
||||||
def collect_incoming_data(self, data):
|
def collect_incoming_data(self, data):
|
||||||
self.inbuf.append(data)
|
self.inbuf.append(data)
|
||||||
|
if len(self.inbuf) > 10:
|
||||||
|
self.err('Too much data, punk.')
|
||||||
|
self.close()
|
||||||
|
|
||||||
def found_terminator(self):
|
def found_terminator(self):
|
||||||
self.last_activity = time.time()
|
self.last_activity = time.time()
|
||||||
|
|
Loading…
Reference in New Issue