def stopSession(self, message):
        """
        Invoked when a Console wishes to terminate an established Session.
        """

        session = Sessions.get(message.system_request.session_id)

        if session is not None:
            return session.device.stopSession(self.connection, session, message)
        else:
            return SystemResponseFactory\
            .error(Message.SystemResponse.SESSION_ID, "unknown session")\
            .inReplyTo(message)\
            .build()
    def stopSession(self, message):
        """
        Invoked when a Console wishes to terminate an established Session.
        """

        session = Sessions.get(message.system_request.session_id)

        if session is not None:
            return session.device.stopSession(self.connection, session,
                                              message)
        else:
            return SystemResponseFactory\
            .error(Message.SystemResponse.SESSION_ID, "unknown session")\
            .inReplyTo(message)\
            .build()
Beispiel #3
0
    def handle(self, message):
        """
        handle() is passed messages for the ReflectionResponseForwarder to
        forward.
        """

        if message.type != Message.REFLECTION_RESPONSE:
            raise Exception("is not a REFLECTION_RESPONSE")
        if not message.HasField('reflection_response'):
            raise Exception("does not contain a REFLECTION_RESPONSE")
        
        session = Sessions.get(message.reflection_response.session_id)

        if session is not None:
            session.console.write(message.SerializeToString())
        else:
            print "no session:", message.reflection_response.session_id
            
    def handle(self, message):
        """
        handle() is passed messages for the ReflectionRequestForwarder to
        forward.
        """

        if message.type != Message.REFLECTION_REQUEST:
            raise Exception("is not a REFLECTION_REQUEST")
        if not message.HasField('reflection_request'):
            raise Exception("does not contain a REFLECTION_REQUEST")
        
        session = Sessions.get(message.reflection_request.session_id)

        if session is not None:
            try:
                session.device.write(message.SerializeToString())
            except DeviceGoneAway as e:
                session.console.write(ReflectionResponseFactory.fatal(str(e)).inReplyTo(message).build())

                session.console.transport.loseConnection()
        else:
            print "no session:", message.reflection_request.session_id
            
    def handle(self, message):
        """
        handle() is passed messages for the ReflectionRequestForwarder to
        forward.
        """

        if message.type != Message.REFLECTION_REQUEST:
            raise Exception("is not a REFLECTION_REQUEST")
        if not message.HasField('reflection_request'):
            raise Exception("does not contain a REFLECTION_REQUEST")

        session = Sessions.get(message.reflection_request.session_id)

        if session is not None:
            try:
                session.device.write(message.SerializeToString())
            except DeviceGoneAway as e:
                session.console.write(
                    ReflectionResponseFactory.fatal(
                        str(e)).inReplyTo(message).build())

                session.console.transport.loseConnection()
        else:
            print "no session:", message.reflection_request.session_id