Beispiel #1
0
    def close(self):
        """
        Close the channel.

        The channel will be closed immediately and will cease to accept
        new connections. Any connections accepted by this channel will
        remain open and will need to be closed separately. If this
        channel has an IPv4 slave (see
        :meth:`~pants.server.Server.listen`) it will be closed.

        Once closed, a channel cannot be re-opened.
        """
        if self._closed:
            return

        self.listening = False

        self.ssl_enabled = False

        if self._slave:
            self._slave.close()

        self._safely_call(self.on_close)

        self._remote_address = None
        self._local_address = None

        _Channel.close(self)
Beispiel #2
0
    def close(self, flush=True):
        """
        Close the channel.
        """
        if self._closed:
            return

        if flush and self._send_buffer:
            self._closing = True
            return

        self.read_delimiter = None
        self._recv_buffer = ""
        self._send_buffer = []

        self.connected = False
        self.connecting = False

        self.ssl_enabled = False
        self._ssl_enabling = False
        self._ssl_socket_wrapped = False
        self._ssl_handshake_done = False
        self._ssl_call_on_connect = False

        self._safely_call(self.on_close)

        self._remote_address = None
        self._local_address = None

        _Channel.close(self)

        self._closing = False
Beispiel #3
0
    def close(self):
        """
        Close the channel.

        The channel will be closed immediately and will cease to accept
        new connections. Any connections accepted by this channel will
        remain open and will need to be closed separately. If this
        channel has an IPv4 slave (see
        :meth:`~pants.server.Server.listen`) it will be closed.

        Once closed, a channel cannot be re-opened.
        """
        if self._closed:
            return

        self.listening = False

        self.ssl_enabled = False

        if self._slave:
            self._slave.close()

        self._safely_call(self.on_close)

        self._remote_address = None
        self._local_address = None

        _Channel.close(self)
Beispiel #4
0
    def close(self, flush=True):
        """
        Close the channel.
        """
        if self._closed:
            return

        if flush and self._send_buffer:
            self._closing = True
            return

        self.read_delimiter = None
        self._recv_buffer = ""
        self._send_buffer = []

        self.connected = False
        self.connecting = False

        self.ssl_enabled = False
        self._ssl_enabling = False
        self._ssl_socket_wrapped = False
        self._ssl_handshake_done = False
        self._ssl_call_on_connect = False

        self._safely_call(self.on_close)

        self._remote_address = None
        self._local_address = None

        _Channel.close(self)

        self._closing = False
Beispiel #5
0
    def close(self):
        """
        Close the channel.
        """
        if self._socket is None:
            return

        self.listening = False

        self._update_addr()

        _Channel.close(self)
Beispiel #6
0
    def close(self):
        """
        Close the channel.
        """
        if self._socket is None:
            return

        self.read_delimiter = None
        self._recv_buffer = {}
        self._send_buffer = []

        self.listening = False

        self._update_addr()

        _Channel.close(self)
Beispiel #7
0
    def close(self, flush=True):
        """
        Close the channel.
        """
        # TODO Implement flushing functionality.
        if self._closed:
            return

        self.read_delimiter = None
        self._recv_buffer = {}
        self._send_buffer = []

        self.listening = False
        self._closing = False

        self._update_addr()

        _Channel.close(self)