def __init__(self, opts, host, port, io_loop=None, resolver=None,
                 connect_callback=None, disconnect_callback=None):
        self.host = host
        self.port = port
        self.connect_callback = connect_callback
        self.disconnect_callback = disconnect_callback

        self.io_loop = io_loop or tornado.ioloop.IOLoop.current()

        self._tcp_client = TCPClientKeepAlive(
            opts, io_loop=self.io_loop, resolver=resolver)

        self._mid = 1
        self._max_messages = int(2 - (1 << 31))  # number of IDs before we wrap

        # TODO: max queue size
        self.send_queue = []  # queue of messages to be sent
        self.send_future_map = {}  # mapping of request_id -> Future
        self.send_timeout_map = {}  # request_id -> timeout_callback

        self._read_until_future = None
        self._on_recv = None
        self._closing = False
        self._connecting_future = self.connect()
        self.io_loop.spawn_callback(self._stream_return)

    # TODO: timeout inflight sessions
dataset/ETHPy150Open saltstack/salt/salt/transport/tcp.py/SaltMessageClient.__init__/swapped operands of `-`