Example #1
0
    def __send(self, command, *args):

        """
        Sends the given command to the given socket and returns the answer.
        """

        xdr.send(self.__sock, command, *args)

        return xdr.recv(self.__sock)
Example #2
0
        def callback(*retval):

            self.__block_timeout[clientsock] = 0

            try:
                xdr.send(clientsock, *retval)

            # hmm, we aren't able to send somthing here
            except socket.error, exc:
                log("Socket is dead!\n%s\n" % exc)
                return False
Example #3
0
        try:
            retval = handler(*args)
            if (retval == None): retval = ()

        # something bad happened while trying to execute the handler
        except Exception:
            from utils.ErrorFormatter import ErrorFormatter
            details = ErrorFormatter().format(sys.exc_info())
            log("Execution of handler (%s, %s) failed!\n%s" % (`handler`,
                                                               `args`,
                                                               details))
            # here we get our broken pipes
            retval = ()

        try:
            xdr.send(clientsock, *retval)

        # hmm, we aren't able to send somthing here
        except socket.error, exc:
            log("Socket is dead!\n%s\n" % exc)
            return False

        # the data seems to be of size zero here
        except xdr.XDRError, exc:
            log("Error: %s\n" % `exc`)

        # something really unexpected has happened
        except Exception:
            try:
                xdr.send_error(clientsock)
            except Exception: