Rework blocking.

Log attempts from banned servers and only block adds, not other
requests.
This commit is contained in:
Simon Howard 2016-06-12 21:23:05 -04:00
parent 118c62ba4b
commit c0975c8f53

View file

@ -240,6 +240,10 @@ class MasterServer:
def process_add_to_master(self, addr): def process_add_to_master(self, addr):
""" Process an "add to master" request received from a server. """ """ Process an "add to master" request received from a server. """
if self.is_blocked(addr):
self.log_output(addr, "Ignoring add from banned server")
return
if addr in self.servers: if addr in self.servers:
self.log_output(addr, "Refresh server") self.log_output(addr, "Refresh server")
server = self.servers[addr] server = self.servers[addr]
@ -377,9 +381,6 @@ class MasterServer:
data, addr = self.sock.recvfrom(1400) data, addr = self.sock.recvfrom(1400)
if self.is_blocked(addr):
return
try: try:
self.process_packet(data, addr) self.process_packet(data, addr)
except Exception, e: except Exception, e: