コード例 #1
0
    def __init__(self, sck, address = None, handler_factory = None):
        self._debug_socket = False
        self._debug_dispatch = False
        self._buffer = b''
        self._sck = sck
        self._address = address
        self._handler = handler_factory
        self.connection_status = "open"
        if self._handler:
            self.handler = self._handler(self)

        self._id = 0
        self._requests = {}
        self._objects = {}

        self.scklock = threading.Lock()
        self.call = Proxy(self, sync_type=0)
        self.method = Proxy(self, sync_type=1)
        self.notify = Proxy(self, sync_type=2)
        self.pipe = Proxy(self, sync_type=3)
        self._wbuffer = b''
        self.write_lock = threading.RLock()
        self.read_lock = threading.RLock()
        self.getid_lock = threading.Lock()
        self.reading_event = threading.Event()
        self.threaded = bjsonrpc_options['threaded']
        self.write_thread_queue = []
        self.write_thread_semaphore = threading.Semaphore(0)
        self.write_thread = threading.Thread(target=self.write_thread)
        self.write_thread.daemon = True
        self.write_thread.start()
コード例 #2
0
    def __init__(self, conn, obj):
        self._conn = conn
        self.name = obj['__remoteobject__']

        self.call = Proxy(self._conn, obj=self.name, sync_type=0)
        self.method = Proxy(self._conn, obj=self.name, sync_type=1)
        self.notify = Proxy(self._conn, obj=self.name, sync_type=2)
        self.pipe = Proxy(self._conn, obj=self.name, sync_type=3)