def processNextResponse(self, socket: zmq.Socket): try: self.log("Awaiting responses") response = socket.recv_multipart() sId = b2s(response[0]) header = json.loads(b2s(response[1])) type = header["type"] self._status = Status.decode(header["status"]) if type == "xarray" and len(response) > 2: dataset = pickle.loads(response[2]) self.cacheResult(header, dataset) elif self._status == Status.ERROR: self._exception = Exception(header["error"]) else: self.cacheResult(header, None) self.log(f"[{sId}]: Received response: " + str(header) + ", new status = " + str(self._status) + ", exception = " + str(self._exception)) except Exception as err: self.log("EDAS error: {0}\n{1}\n".format(err, traceback.format_exc())) self._exception = err
def __receive_message(self, socket: zmq.Socket) -> Union[FuzzerCtrlMsg, JobMsg]: msg_type, raw_msg = socket.recv_multipart() if msg_type == _MessageType.CONTROL.value: ctrl_msg = FuzzerCtrlMsg() ctrl_msg.ParseFromString(raw_msg) return ctrl_msg elif msg_type == _MessageType.SEED.value: # JobMsg are marked with "S" in the protocol job_msg = JobMsg() job_msg.ParseFromString(raw_msg) return job_msg else: raise ConnectionException( f"Received message with unsupported type: {msg_type}")