class_docstr: Internal proxy server handler class.
class_docstr_tok: ["Internal","proxy","server","handler","class","."]
code: def __init__(
      self,
      sock,
      listen_port,
      web_port,
      timeout_client,
      timeout_server,
      tracker_addr,
      index_page=None,
      resource_files=None,
  ):
      assert ProxyServerHandler.current is None
      ProxyServerHandler.current = self
      if web_port:
          handlers = [(r"/ws", WebSocketHandler)]
          if index_page:
              handlers.append(
                  (
                      r"/",
                      RequestHandler,
                      {
                          "file_path": index_page,
                          "rpc_web_port": web_port,
                      },
                  )
              )
              logging.info(
                  "Serving RPC index html page at http://localhost:%d",
                  web_port,
              )
          resource_files = resource_files if resource_files else []
          for fname in resource_files:
              basename = os.path.basename(fname)
              pair = (
                  rf"/{basename}",
                  RequestHandler,
                  {"file_path": fname},
              )
              handlers.append(pair)
              logging.info(pair)
          self.app = tornado.web.Application(handlers)
          self.app.listen(web_port)
  
      self.sock = sock
      self.sock.setblocking(0)
      self.loop = ioloop.IOLoop.current()
  
      def event_handler(_, events):
          self._on_event(events)
  
      self.loop.add_handler(
          self.sock.fileno(), event_handler, self.loop.READ
      )
      self._client_pool = {}
      self._server_pool = {}
      self.timeout_alloc = 5
      self.timeout_client = timeout_client
      self.timeout_server = timeout_server
      # tracker information
      self._listen_port = listen_port
      self._tracker_addr = tracker_addr
      self._tracker_conn = None
      self._tracker_pending_puts = []
      self._key_set = set()
      self.update_tracker_period = 2
      if tracker_addr:
          logging.info("Tracker address:%s", str(tracker_addr))
  
          def _callback():
              self._update_tracker(True)
  
          self.loop.call_later(self.update_tracker_period, _callback)
      logging.info("RPCProxy: Websock port bind to %d", web_port)
  
imports: import os
  import asyncio
  import logging
  import socket
  import threading
  import errno
  import struct
  import time
  from tvm.contrib.popen_pool import PopenWorker
  from .None import _ffi_api
  from .None import base
  from .base import TrackerCode
  from .server import _server_env
  from .._ffi.base import py_str
label_desc: Use image node_id 1 to create a new ProxyServerHandler object from inherited base classes: object with example: obj = ProxyServerHandler(sock, listen_port, web_port, timeout_client, timeout_server, tracker_addr, index_page, resource_files)