Esempio n. 1
0
    def __init__(self):
        """
Constructor __init__(Handler)

:since: v0.2.00
        """

        Thread.__init__(self)

        self.active_id = -1
        """
Queue ID
        """
        self.address = None
        """
Address of the received data
        """
        self.address_family = None
        """
Address family of the received data
        """
        self.data = Binary.BYTES_TYPE()
        """
Data buffer
        """
        self.log_handler = NamedLoader.get_singleton("dNG.data.logging.LogHandler", False)
        """
The LogHandler is called whenever debug messages should be logged or errors
happened.
        """
        self.server = None
        """
Server instance
        """
        self.socket = None
        """
Socket instance
        """
        self.timeout = int(Settings.get("pas_global_server_socket_data_timeout", 0))
        """
Request timeout value
        """

        if (self.timeout < 1): self.timeout = int(Settings.get("pas_global_socket_data_timeout", 30))
Esempio n. 2
0
    def __init__(self):
        """
Constructor __init__(GlibThread)

:since: v0.2.00
        """

        Thread.__init__(self)

        self.log_handler = NamedLoader.get_singleton("dNG.data.logging.LogHandler", False)
        """
The LogHandler is called whenever debug messages should be logged or errors
happened.
        """
        self.mainloop = None
        """
Active mainloop instance
        """

        Hook.register_weakref("dNG.pas.Status.onShutdown", self.stop)
Esempio n. 3
0
    def __init__(self):
        """
Constructor __init__(AbstractServer)

:since: v1.0.0
        """

        Thread.__init__(self)

        self.host = None
        """
Configured server host
        """
        self._log_handler = NamedLoader.get_singleton("dNG.data.logging.LogHandler", False)
        """
The LogHandler is called whenever debug messages should be logged or errors
happened.
        """
        self.port = None
        """
Configured server port
        """
        self.socket_hostname = None
        """
Socket server hostname
        """

        socket_hostname = getfqdn()

        try:
            getaddrinfo(socket_hostname, None)
            self.socket_hostname = socket_hostname
        except socket_error: self.socket_hostname = gethostname()

        self.socket_hostname = self.socket_hostname.lower()

        Hook.register_weakref("dNG.pas.http.Server.getHost", self.get_host)
        Hook.register_weakref("dNG.pas.http.Server.getPort", self.get_port)