Example #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)
Example #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)
Example #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)
Example #4
0
File: rpc.py Project: 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
Example #5
0
File: rpc.py Project: 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
Example #6
0
File: rpc.py Project: 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
Example #7
0
File: rpc.py Project: 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