Commits

Jeffrey Gelens committed d145f57

Removed print statements

  • Participants
  • Parent commits 7f26223
  • Tags 0.1

Comments (0)

Files changed (3)

geventsocketio/handler.py

         path = self.environ.get('PATH_INFO')
         parts = SocketIOHandler.path_re.match(path)
 
-        print "Arrived at", path
-
         if parts:
             parts = parts.groupdict()
-            print parts
         else:
             return super(SocketIOHandler, self).handle_one_response()
 
         request_method = self.environ.get("REQUEST_METHOD")
 
         if resource != self.server.resource or not transport:
-            print "other resource"
             return super(SocketIOHandler, self).handle_one_response()
 
         if transport == transports.WebsocketTransport or \
         self.application(self.environ, lambda x: x())
 
         session.connected = False
-        print "exit"
         gevent.joinall(jobs)

geventsocketio/protocol.py

             while self.connected():
                 gevent.sleep(10)
                 hb = HEARTBEAT_FRAME + str(self.session.heartbeats())
-                print hb
                 self._write(hb, self.session)
 
         return gevent.spawn(ping)
 
     def check_heartbeat(self, counter):
-        # TODO: check for valid counter value
-        print "pong", counter
-        # TODO: check if we have a timeout
+        counter = int(counter[len(HEARTBEAT_FRAME):])
+
+        if self.session.valid_heartbeat(counter):
+            return
+        else:
+            self.session.kill()
 
     def _write(self, message, session=None):
         if session is None:

geventsocketio/server.py

         self.hearbeats += 1
         return self.hearbeats
 
+    def valid_heartbeat(self, counter):
+        return self.hearbeats == counter
+
     def is_new(self):
         return self.hits == 0