Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Skip unknown protocols

  • Loading branch information...
commit 2a8d15beb90e288a0d2c1296056cdcb3a13e955c 1 parent 68c6705
@eugeni authored
Showing with 16 additions and 12 deletions.
  1. +1 −1  openclass/protocol.py
  2. +15 −11 student.py
View
2  openclass/protocol.py
@@ -100,7 +100,7 @@ def parse_announce(self, announce):
return (name.strip(), flags)
except:
self.logger.exception("Parsing protocol announce")
- return None
+ return None, None
def pack_chunk(self, screen_width, screen_height, fullscreen, chunk):
"""Packs a chunk into network-specific format for sending"""
View
26 student.py
@@ -530,18 +530,22 @@ def monitor_bcast(self):
data, source = self.bcast.get_msg()
# if there is an announce, but we are not yet logged in, skip
msg = self.protocol.parse_header(data)
- name, flags = self.protocol.parse_announce(msg)
- self.logger.debug("Found teacher <%s> at %s" % (name, source))
- model = self.teachers.get_model()
- if name not in [x[0] for x in model]:
- self.teachers.append_text(name)
- self.teachers_addr[name] = source
- # should we enable the login dialog?
- if len(model) > 0:
- self.teachers.set_active(0)
+ if msg == None:
+ # Was the protocol parsed correctly?
+ self.logger.info("Skipping unknown protocol announced by %s" % source)
else:
- # same teacher
- pass
+ name, flags = self.protocol.parse_announce(msg)
+ self.logger.debug("Found teacher <%s> at %s" % (name, source))
+ model = self.teachers.get_model()
+ if name not in [x[0] for x in model]:
+ self.teachers.append_text(name)
+ self.teachers_addr[name] = source
+ # should we enable the login dialog?
+ if len(model) > 0:
+ self.teachers.set_active(0)
+ else:
+ # same teacher
+ pass
gobject.timeout_add(1000, self.monitor_bcast)
if __name__ == "__main__":
Please sign in to comment.
Something went wrong with that request. Please try again.