Пример #1
0
 def mainloop_send(self):
     try:
         while True:
             job = self._send_queue.get()
             self._sock.send(dumpb(job), copy=False)
     except zmq.ContextTerminated:
         pass
Пример #2
0
    def mainloop_send(self):
        try:
            while True:
                if self._tosock.closed:
                    break

                job = self._send_queue.get()
                self._tosock.send_multipart([job.identifier, dumpb(job.payload)], copy=False)
        except zmq.ContextTerminated:
            pass
        except zmq.ZMQError as e:
            if self._tosock.closed:
                logger.warning('Send socket closed unexpectedly.')
            else:
                raise e
Пример #3
0
 def query(self, type, inp=None, do_recv=True):
     self._tosock.send(dumpb((self.identity, type, inp)), copy=False)
     if do_recv:
         return self.recv()
Пример #4
0
def push_pyobj(sock, data, flag=zmq.NOBLOCK):
    try:
        sock.send(dumpb(data), flag, copy=False)
    except zmq.error.ZMQError:
        return False
    return True
Пример #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