def initialize(self, *args, **kwargs): """The ``ssl_options`` keyword argument may either be an `SSL.SSLContext` object or a dictionary of keywords arguments for `ssl.wrap_socket` """ self._ssl_options = kwargs.pop('ssl_options', _client_m2_ssl_defaults) self._asServer = self._ssl_options.get('asServer', False) IOStream.__init__(self, *args, **kwargs) self._ssl_accepting = True self._handshake_reading = False self._handshake_writing = False self._ssl_connect_callback = None self._server_hostname = None # If the socket is already connected, attempt to start the handshake. try: n = self.socket.getpeername() print "CHRIS peer name %s" % (n, ) except socket.error: pass else: # Indirectly start the handshake, which will run on the next # IOLoop iteration and then the real IO state will be set in # _handle_events. self._add_io_state(self.io_loop.WRITE)
def __init__(self, camera_id, port, username, password): self._camera_id = camera_id self._port = port self._username = (username or "").encode("utf8") self._password = (password or "").encode("utf8") self._auth_digest_state = {} s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) IOStream.__init__(self, s) self.set_close_callback(self.on_close)
def __init__(self, camera_id, port, username, password, auth_mode): self._camera_id = camera_id self._port = port self._username = (username or '').encode('utf8') self._password = (password or '').encode('utf8') self._auth_mode = auth_mode self._auth_digest_state = {} self._last_access = None self._last_jpg = None self._last_jpg_times = [] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) IOStream.__init__(self, s) self.set_close_callback(self.on_close)
def __init__(self, camera_id, port, username, password, auth_mode): self._camera_id = camera_id self._port = port self._username = (username or '').encode('utf8') self._password = (password or '').encode('utf8') self._auth_mode = auth_mode self._auth_digest_state = {} self._last_access = 0 self._last_jpg = None self._last_jpg_times = [] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) IOStream.__init__(self, s) self.set_close_callback(self.on_close)
def initialize(self, *args, **kwargs): """The ``ssl_options`` keyword argument may either be an `~M2Crypto.SSL.SSLContext` object or a dictionary of keywords arguments (see `~m2netutil.ssl_options_to_m2_context`.) """ self._ssl_options = kwargs.pop('ssl_options', _client_m2_ssl_defaults) if kwargs.pop('create_context_on_init', False): server_side = kwargs.pop('server_side', False) do_handshake_on_connect = kwargs.pop('do_handshake_on_connect', False) connection = args[0] self.socket = m2_wrap_socket(connection, self._ssl_options, server_side = server_side, do_handshake_on_connect=do_handshake_on_connect) args = (self.socket,) + args[1:] IOStream.__init__(self, *args, **kwargs) self._done_setup = False self._ssl_accepting = True self._handshake_reading = False self._handshake_writing = False self._ssl_connect_callback = None self._server_hostname = None # If the socket is already connected, attempt to start the handshake. try: n = self.socket.getpeername() except socket.error: pass else: # Indirectly start the handshake, which will run on the next # IOLoop iteration and then the real IO state will be set in # _handle_events. self._add_io_state(self.io_loop.WRITE)