Beispiel #1
0
    def data_to_server(self, command, sessid, **kwargs):
        """
        Send data across the wire to the Server.

        Args:
            command (AMP Command): A protocol send command.
            sessid (int): A unique Session id.

        Returns:
            deferred (deferred or None): A deferred with an errback.

        Notes:
            Data will be sent across the wire pickled as a tuple
            (sessid, kwargs).

        """
        if self.factory.server_connection:
            return self.factory.server_connection.callRemote(
                command, packed_data=amp.dumps(
                    (sessid, kwargs))).addErrback(self.errback, command.key)
        else:
            # if no server connection is available, broadcast
            return self.broadcast(command,
                                  sessid,
                                  packed_data=amp.dumps((sessid, kwargs)))
Beispiel #2
0
    def send_Status2Launcher(self):
        """
        Send a status stanza to the launcher.

        """
        if self.factory.launcher_connection:
            self.factory.launcher_connection.callRemote(
                amp.MsgStatus, status=amp.dumps(self.get_status())).addErrback(
                    self.errback, amp.MsgStatus.key)
Beispiel #3
0
    def send_Status2Launcher(self):
        """
        Send a status stanza to the launcher.

        """
        if self.factory.launcher_connection:
            self.factory.launcher_connection.callRemote(
                    amp.MsgStatus,
                    status=amp.dumps(self.get_status())).addErrback(
                            self.errback, amp.MsgStatus.key)
Beispiel #4
0
    def portal_receive_status(self, status):
        """
        Returns run-status for the server/portal.

        Args:
            status (str): Not used.
        Returns:
            status (dict): The status is a tuple
                (portal_running, server_running, portal_pid, server_pid).

        """
        return {"status": amp.dumps(self.get_status())}
Beispiel #5
0
    def portal_receive_status(self, status):
        """
        Returns run-status for the server/portal.

        Args:
            status (str): Not used.
        Returns:
            status (dict): The status is a tuple
                (portal_running, server_running, portal_pid, server_pid).

        """
        return {"status": amp.dumps(self.get_status())}
Beispiel #6
0
    def data_to_server(self, command, sessid, **kwargs):
        """
        Send data across the wire to the Server.

        Args:
            command (AMP Command): A protocol send command.
            sessid (int): A unique Session id.

        Returns:
            deferred (deferred or None): A deferred with an errback.

        Notes:
            Data will be sent across the wire pickled as a tuple
            (sessid, kwargs).

        """
        if self.factory.server_connection:
            return self.factory.server_connection.callRemote(
                        command, packed_data=amp.dumps((sessid, kwargs))).addErrback(
                            self.errback, command.key)
        else:
            # if no server connection is available, broadcast
            return self.broadcast(command, sessid, packed_data=amp.dumps((sessid, kwargs)))
Beispiel #7
0
    def data_to_portal(self, command, sessid, **kwargs):
        """
        Send data across the wire to the Portal

        Args:
            command (AMP Command): A protocol send command.
            sessid (int): A unique Session id.
            kwargs (any): Any data to pickle into the command.

        Returns:
            deferred (deferred or None): A deferred with an errback.

        Notes:
            Data will be sent across the wire pickled as a tuple
            (sessid, kwargs).

        """
        return self.callRemote(command, packed_data=amp.dumps((sessid, kwargs))).addErrback(
                self.errback, command.key)
Beispiel #8
0
    def data_to_portal(self, command, sessid, **kwargs):
        """
        Send data across the wire to the Portal

        Args:
            command (AMP Command): A protocol send command.
            sessid (int): A unique Session id.
            kwargs (any): Any data to pickle into the command.

        Returns:
            deferred (deferred or None): A deferred with an errback.

        Notes:
            Data will be sent across the wire pickled as a tuple
            (sessid, kwargs).

        """
        return self.callRemote(command, packed_data=amp.dumps((sessid, kwargs))).addErrback(
                self.errback, command.key)