Beispiel #1
0
    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
Beispiel #2
0
 def recv(self):
     out = loadb(self._frsock.recv(copy=False).bytes)
     return out
Beispiel #3
0
def pull_pyobj(sock, flag=zmq.NOBLOCK):
    try:
        response = loadb(sock.recv(flag, copy=False).bytes)
        return response
    except zmq.error.ZMQError:
        return None
Beispiel #4
0
 def recv(self):
     try:
         return loadb(self._sock.recv(copy=False).bytes)
     except zmq.ContextTerminated:
         pass
Beispiel #5
0
 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