INNER CODE UNIT · Python

apply_registration_response

ChrispyBacon-dev/DockFlare · dockflare-agent/app/main.py:145

def apply_registration_response(data):
    global AGENT_ID, PROTOCOL_VERSION, AGENT_SESSION_ID, _event_sequence, _report_sequence
    agent_id = data.get("agent_id") if isinstance(data, dict) else None
    protocol = data.get("protocol_version") if isinstance(data, dict) else None
    session_id = data.get("agent_session_id") if isinstance(data, dict) else None
    if not agent_id:
        return False
    if protocol == 2 and not session_id:
        return False
    if protocol not in (None, 1, 2):
        return False
    with _protocol_lock:
        AGENT_ID = agent_id
        PROTOCOL_VERSION = protocol or 1
        AGENT_SESSION_ID = session_id if protocol == 2 else None
        _event_sequence = 0
        _report_sequence = 0
    return True

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…