def mainloop_recv(self): try: while True: if self._frsock.closed: break msg = loadb(self._frsock.recv(copy=False).bytes) identifier, type, payload = msg self._dispatcher.dispatch(type, self, identifier, payload) except zmq.ContextTerminated: pass except zmq.ZMQError as e: if self._tosock.closed: logger.warning('Recv socket closed unexpectedly.') else: raise e
def recv(self): out = loadb(self._frsock.recv(copy=False).bytes) return out
def pull_pyobj(sock, flag=zmq.NOBLOCK): try: response = loadb(sock.recv(flag, copy=False).bytes) return response except zmq.error.ZMQError: return None
def recv(self): try: return loadb(self._sock.recv(copy=False).bytes) except zmq.ContextTerminated: pass
def query(self, type, inp, do_recv=True): self._tosock.send(dumpb((self.identity, type, inp)), copy=False) if do_recv: out = loadb(self._frsock.recv(copy=False).bytes) return out