INNER CODE UNIT · Python
Envelope
codedpro/mt5-trade-split-manager · server.py:103
class Envelope:
"""One in-flight command plus the machinery to deliver its response back to
exactly the request that issued it."""
__slots__ = ("cmd", "event", "result", "abandoned")
def __init__(self, cmd: dict):
self.cmd = cmd
self.event = threading.Event()
self.result = None
self.abandoned = False
# Queue of Envelopes waiting to be handed to the EA on its next poll.
command_queue: "queue.Queue[Envelope]" = queue.Queue()
def _read_json_response(sock: socket.socket) -> dict:
"""Read from the EA until a complete JSON object has arrived."""