Handle flooding

This commit is contained in:
Neale Pickett 2009-08-26 16:33:07 -06:00
parent 689bff487c
commit de6a455ebc
1 changed files with 5 additions and 5 deletions

10
game.py
View File

@ -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()