Exemplo n.º 1
0
    def rtmp_connect(self, params, *args):
        """
        The business logic of connecting to the application.

        @param params: The connection parameters sent from the client, this
            includes items such as the connection url, and user agent
        @type params: C{dict}

        @param args: arguments from RTMP connect packet
        """
        if self.nc:
            # This protocol has already successfully completed a connection
            # request.
            raise exc.ConnectFailed('Already connected.')

        self.nc = self.buildNetConnection()

        try:
            yield self.nc.connect(params, *args)
        except Exception, e:
            f = failure.Failure()

            log.err(f)

            result = status.fromFailure(f, codes.NC_CONNECT_FAILED)

            def cb():
                self.transport.loseConnection()

            result = rpc.ResultWithCallback(result, cb)

            defer.returnValue(result)
Exemplo n.º 2
0
        def eb(fail):
            """
            Called when an error occurred when asking the application to
            validate the connection request.
            """
            if self.application and self.client:
                self.application.onConnectReject(self.client, fail, *args)

            return status.fromFailure(fail, codes.NC_CONNECT_FAILED,
                objectEncoding=self.objectEncoding)
Exemplo n.º 3
0
        def eb(fail):
            """
            Called when an error occurred when asking the application to
            validate the connection request.
            """
            if self.application and self.client:
                self.application.onConnectReject(self.client, fail, *args)

            return status.fromFailure(fail, codes.NC_CONNECT_FAILED,
                objectEncoding=self.objectEncoding)
Exemplo n.º 4
0
Arquivo: rpc.py Projeto: jasimmk/rtmpy
        def eb(fail):
            if callId == NO_RESULT:
                return fail

            self.finishCall(callId)

            error = status.fromFailure(fail, exc.CallFailed)
            msg = message.Invoke(RESPONSE_ERROR, callId, None, error)

            self.sendMessage(msg)

            return fail
Exemplo n.º 5
0
Arquivo: rpc.py Projeto: Arlex/rtmpy
        def eb(fail):
            if callId == NO_RESULT:
                return fail

            self.finishCall(callId)

            whenDone = None

            if isinstance(fail, ResultWithCallback):
                whenDone = fail.callback
                fail = fail.result

            error = status.fromFailure(fail, exc.CallFailed)
            msg = message.Invoke(RESPONSE_ERROR, callId, None, error)

            self.sendMessage(msg, whenDone=whenDone)

            return fail
Exemplo n.º 6
0
Arquivo: rpc.py Projeto: jasimmk/rtmpy
        def eb(fail):
            if callId == NO_RESULT:
                return fail

            self.finishCall(callId)

            whenDone = None

            if isinstance(fail, ResultWithCallback):
                whenDone = fail.callback
                fail = fail.result

            error = status.fromFailure(fail, exc.CallFailed)
            msg = message.Invoke(RESPONSE_ERROR, callId, None, error)

            self.sendMessage(msg, whenDone=whenDone)

            return fail
Exemplo n.º 7
0
Arquivo: rpc.py Projeto: njoyce/rtmpy
        def eb(fail):
            if callId == NO_RESULT:
                return fail

            self._farContext.finishCall(callId)

            whenDone = None

            # wow, wtf
            if isinstance(fail, ResultWithCallback):
                whenDone = fail.callback
                fail = fail.result

            error = status.fromFailure(fail, exc.CallFailed)

            self.dispatchCall(RESPONSE_ERROR, callId, None, error,
                whenDone=whenDone)

            return fail