Example #1
0
    def __init__(self, ConnectionClass=None, **kwargs):
        sock = kwargs.get("socket", None)
        if sock and sock_type(sock) != socket.SOCK_STREAM:
            raise TypeError(
                "Cannot create a %s with a socket type other than SOCK_STREAM."
                % self.__class__.__name__)

        _Channel.__init__(self, **kwargs)

        # Socket
        self._remote_address = None
        self._local_address = None

        self._slave = None

        # Channel state
        self.listening = False

        # SSL state
        self.ssl_enabled = False
        self._ssl_options = None
        if kwargs.get("ssl_options", None) is not None:
            self.startSSL(kwargs["ssl_options"])

        # Connection class
        if ConnectionClass is not None:
            self.ConnectionClass = ConnectionClass
        self.channels = weakref.WeakValueDictionary()
Example #2
0
    def __init__(self, ConnectionClass=None, **kwargs):
        sock = kwargs.get("socket", None)
        if sock and sock_type(sock) != socket.SOCK_STREAM:
            raise TypeError("Cannot create a %s with a socket type other than SOCK_STREAM."
                    % self.__class__.__name__)

        _Channel.__init__(self, **kwargs)

        # Socket
        self._remote_address = None
        self._local_address = None

        self._slave = None

        # Channel state
        self.listening = False

        # SSL state
        self.ssl_enabled = False
        self._ssl_options = None
        if kwargs.get("ssl_options", None) is not None:
            self.startSSL(kwargs["ssl_options"])

        # Connection class
        if ConnectionClass is not None:
            self.ConnectionClass = ConnectionClass
        self.channels = weakref.WeakValueDictionary()
Example #3
0
    def __init__(self, **kwargs):
        sock = kwargs.get("socket", None)
        if sock and sock_type(sock) != socket.SOCK_STREAM:
            raise TypeError("Cannot create a %s with a socket type other than SOCK_STREAM."
                    % self.__class__.__name__)

        _Channel.__init__(self, **kwargs)

        # Socket
        self._remote_address = None
        self._local_address = None

        # I/O attributes
        self._read_delimiter = None
        self._recv_buffer = ""
        self._recv_buffer_size_limit = self._buffer_size
        self._send_buffer = []

        # Channel state
        self.connected = False
        self.connecting = False
        self._closing = False

        # SSL state
        self.ssl_enabled = False
        self._ssl_enabling = False
        self._ssl_socket_wrapped = False
        self._ssl_handshake_done = False
        self._ssl_call_on_connect = False
        if isinstance(kwargs.get("socket", None), ssl.SSLSocket):
            self._ssl_socket_wrapped = True
            self.startSSL()
        elif kwargs.get("ssl_options", None) is not None:
            self.startSSL(kwargs["ssl_options"])
Example #4
0
    def __init__(self, **kwargs):
        sock = kwargs.get("socket", None)
        if sock and sock_type(sock) != socket.SOCK_STREAM:
            raise TypeError(
                "Cannot create a %s with a socket type other than SOCK_STREAM."
                % self.__class__.__name__)

        _Channel.__init__(self, **kwargs)

        # Socket
        self._remote_address = None
        self._local_address = None

        # I/O attributes
        self._read_delimiter = None
        self._recv_buffer = ""
        self._recv_buffer_size_limit = self._buffer_size
        self._send_buffer = []

        # Channel state
        self.connected = False
        self.connecting = False
        self._closing = False

        # SSL state
        self.ssl_enabled = False
        self._ssl_enabling = False
        self._ssl_socket_wrapped = False
        self._ssl_handshake_done = False
        self._ssl_call_on_connect = False
        if isinstance(kwargs.get("socket", None), ssl.SSLSocket):
            self._ssl_socket_wrapped = True
            self.startSSL()
        elif kwargs.get("ssl_options", None) is not None:
            self.startSSL(kwargs["ssl_options"])