https://github.com/bitcoin/bitcoin/commit/2b781ad66e34000037f589c71366c203255ed058#r83655059
{
    auto sock = Hello();
    const Reply& reply = SendRequestAndGetReply(
        *sock, strprintf("STREAM ACCEPT ID=%s SILENT=false", m_session_id), false);
    const std::string& result = reply.Get("RESULT");
    if (result == "OK") {
        return sock;
    }
    if (result == "INVALID_ID") {
        
        Disconnect();
    }
    throw std::runtime_error(strprintf("\"%s\"", reply.full));
}
void Session::Disconnect()
{
    if (m_control_sock->Get() != INVALID_SOCKET) {
        if (m_session_id.empty()) {
            Log("Destroying incomplete SAM session");
        } else {
            Log("Destroying SAM session %s", m_session_id);
        }
    }
    m_control_sock = std::make_unique<Sock>(INVALID_SOCKET);
    m_session_id.clear();
}
} 
}