def connectionLost(self, reason):
		if DEBUG >= 1:
			print("WebSocket connection closed: {0}".format(reason))
		WebSocketServerProtocol.connectionLost(self, reason)
		self.factory.unregister(self)
		name.pop(self.peer, None)
		self.sendUsers()
Exemple #2
0
   def connectionLost(self, reason):
      WebSocketServerProtocol.connectionLost(self, reason)

      self.factory.stats.trackOctetsWireIn(self.trafficStats.preopenIncomingOctetsWireLevel + \
                                           self.trafficStats.incomingOctetsWireLevel)

      self.factory.stats.trackOctetsWireOut(self.trafficStats.preopenOutgoingOctetsWireLevel + \
                                            self.trafficStats.outgoingOctetsWireLevel)
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     try:
         namespace = self.getNamespace()
     except NamespaceNotFound:
         pass
     else:
         namespace.client_disconnected(self)
class ExceptionHandlingTests(unittest.TestCase):
    """
    Tests that we format various exception variations properly during
    connectionLost
    """

    def setUp(self):
        self.factory = WebSocketServerFactory()
        self.proto = WebSocketServerProtocol()
        self.proto.factory = self.factory
        self.proto.log = Mock()

    def tearDown(self):
        for call in [
                self.proto.autoPingPendingCall,
                self.proto.autoPingTimeoutCall,
                self.proto.openHandshakeTimeoutCall,
                self.proto.closeHandshakeTimeoutCall,
        ]:
            if call is not None:
                call.cancel()

    def test_connection_done(self):
        # pretend we connected
        self.proto._connectionMade()

        self.proto.connectionLost(Failure(ConnectionDone()))

        messages = ' '.join([str(x[1]) for x in self.proto.log.mock_calls])
        self.assertTrue('closed cleanly' in messages)

    def test_connection_aborted(self):
        # pretend we connected
        self.proto._connectionMade()

        self.proto.connectionLost(Failure(ConnectionAborted()))

        messages = ' '.join([str(x[1]) for x in self.proto.log.mock_calls])
        self.assertTrue(' aborted ' in messages)

    def test_connection_lost(self):
        # pretend we connected
        self.proto._connectionMade()

        self.proto.connectionLost(Failure(ConnectionLost()))

        messages = ' '.join([str(x[1]) for x in self.proto.log.mock_calls])
        self.assertTrue(' was lost ' in messages)

    def test_connection_lost_arg(self):
        # pretend we connected
        self.proto._connectionMade()

        self.proto.connectionLost(Failure(ConnectionLost("greetings")))

        messages = ' '.join([str(x[1]) + str(x[2]) for x in self.proto.log.mock_calls])
        self.assertTrue(' was lost ' in messages)
        self.assertTrue('greetings' in messages)
 def connectionLost(self, reason):
     """
     При аварийном завершении коннекта
     :param reason:
     :return:
     """
     #проверяется список приконекченных клиентов,
     #каждый клиент - одна вкладка
     if self.factory.clients[self] != '':
         #если не пуст список
         #json с новым списком клиентов и инфой, что один отдисконнектился
         disconnect_msg = json.dumps({'user_disconnect':
                                      self.factory.clients[self]})
         #возвращаем инфу клиенту о дисконекте
         self.factory.broadcast(disconnect_msg, self)
     #удаляем объект, чистим следы
     self.factory.remove_game(self)
     self.factory.unregister(self)
     #посылаем общее сообщение, что коннект завершен с причиной
     WebSocketServerProtocol.connectionLost(self, reason)
Exemple #6
0
 def connectionLost(self, reason):
     logger.debug('Connection lost: %s' % reason)
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #7
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     #super(WebSocketProcessOutputterThing, self).connectionLost(self, reason)
     self.factory.unregister(self)
	def connectionLost(self,reason):
		print "CONNECTION LOST %s" % reason
		WebSocketServerProtocol.connectionLost(self,reason)
		self.factory.unregister(self)
Exemple #9
0
 def connectionLost(self, *args):
     if self.client:
         self.client.finished.errback(*args)
     WebSocketServerProtocol.connectionLost(self, *args)
Exemple #10
0
 def connectionLost(self, reason):
   self.logout()
   BaseProtocol.connectionLost(self, reason)
Exemple #11
0
 def connectionLost(self,
                    reason):  # todo deconnect clients if server crashes
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #12
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.deregister(self)
Exemple #13
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     self.log.info('Client ' + self.peer + "@" + self.clientLibrary() +
                   ' on ' + self.clientPlatform() + " disconnected")
     self.factory.unregister(self)
     self._state = ClientState.disconnected
Exemple #14
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
     self.factory.broadcastChatUsers()
Exemple #15
0
 def connectionLost(self, reason):
     self.factory.lostConnection(self)
     WebSocketServerProtocol.connectionLost(self, reason)
Exemple #16
0
	def connectionLost(self,reason):
		self.factory.forward("stop",False,self)
		self.factory.stopProducing(self)
		WebSocketServerProtocol.connectionLost(self,reason)
		self.factory.unregister(self)
Exemple #17
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     if hasattr(self, "trans_sess"):
         self.trans_sess.stop()
 def connectionLost(self,reason): 
     #logger.debug("connectionLost() called for reason: ",reason)
     WebSocketServerProtocol.connectionLost(self,reason) 
     self.factory.unregister(self.feed_id,self.format,self.isFront) 
Exemple #19
0
	def connectionLost(self,reason):
		#self.factory.sendCommand("pause",False,self)
		self.deletePlaylist()
		self.deleteSegments()
		WebSocketServerProtocol.connectionLost(self,reason)
		self.factory.unregister(self)
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     Protocol.connectionLost(self, reason)
Exemple #21
0
 def connectionLost(self, reason):
     print("WebSocket connection lost: {0}".format(reason))
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #22
0
 def connectionLost(self, reason):
     """Called when websocket client is disconnected"""
     self.factory.unregister(self)
     WebSocketServerProtocol.connectionLost(self, reason)
Exemple #23
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     BroadcastServerFactory.unregister(self)
Exemple #24
0
    def connectionLost(self,reason):
		WebSocketServerProtocol.connectionLost(self,reason)
		self.factory.unregister(self)
		print("Websocket connection lost: {0}".format(reason))
Exemple #25
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     if hasattr(self, "trans_sess"):
         self.trans_sess.stop()
 def connectionLost(self, reason):
     """ Overridden to ensure that we aren't attempting to
     send notifications on broken connections.
     """
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #27
0
 def connectionLost(self, reason):
     self.factory.forward("stop", False, self)
     self.factory.stopProducing(self)
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #28
0
 def connectionLost(self, reason):
     #self.factory.sendCommand("pause",False,self)
     self.deletePlaylist()
     self.deleteSegments()
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #29
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     if hasattr(self, 'player'):
         self.player.destroy()
Exemple #30
0
 def connectionLost(self, reason):
     self.deletePlaylist()
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #31
0
 def connectionLost(self, reason):
     self.factory.lostConnection(self)
     WebSocketServerProtocol.connectionLost(self, reason)
Exemple #32
0
 def onClose(self, wasClean, code, reason):
     reason.value = "Client closed connection"
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
     print("Connection to client closed!")
Exemple #33
0
 def connectionLost(self,reason):
     logger.info("Connection lost %s" % reason)
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #34
0
 def connectionLost(self, *args):
     if self.client:
         self.client.finished.errback(*args)
     WebSocketServerProtocol.connectionLost(self, *args)
 def connectionLost(self, reason):
     """Log when the connection is lost"""
     self._log('Connection lost')
     WebSocketServerProtocol.connectionLost(self, reason)
	def connectionLost(self,reason):
		self.do_feed = False
		self.factory.streamer.stopProducing()
		WebSocketServerProtocol.connectionLost(self,reason)
		self.factory.unregister(self)
Exemple #37
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     if hasattr(self, 'player'):
         self.player.destroy()
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     #super(WebSocketProcessOutputterThing, self).connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #39
0
 def connectionLost(self, reason):
     logger.debug('Connection lost: %s' % reason)
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #40
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
     self.redis.delete(self.peer)
Exemple #41
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
     bridge.socketIn.close()
     bridge.socketOut.close()
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
 def connectionLost(self, reason):
   WebSocketServerProtocol.connectionLost(self, reason)
   self.factory.unregister(self)
Exemple #44
0
 def connectionLost(self, reason):
     print 'connectionLost'
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #45
0
 def connectionLost(self, reason):
     self.do_feed = False
     self.factory.streamer.stopProducing()
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
Exemple #46
0
 def connectionLost(self, reason):
     WebSocketServerProtocol.connectionLost(self, reason)
     self.factory.unregister(self)
     world.rooms[world.players[self.name].location].remove_entity(
         world.players[self.name])
     world.rooms[world.players[self.name].location].alert_exit(self.name)