From 19969394ab4492ae4991ca233598f003dd13d0eb Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 8 May 2024 01:52:26 -0400 Subject: [PATCH 1/4] FIRE-31368 prototype hop url fixes --- indra/newview/llworldmapmessage.cpp | 10 ++ indra/newview/llworldmapmessage.fs.c++ | 185 +++++++++++++++++++++++++ indra/newview/llworldmapmessage.fs.h | 13 ++ 3 files changed, 208 insertions(+) create mode 100644 indra/newview/llworldmapmessage.fs.c++ create mode 100644 indra/newview/llworldmapmessage.fs.h diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp index 0426fb338c..c0ddd453dd 100644 --- a/indra/newview/llworldmapmessage.cpp +++ b/indra/newview/llworldmapmessage.cpp @@ -35,6 +35,9 @@ // Aurora Sim #include "llviewernetwork.h" +#ifdef OPENSIM +#include "llworldmapmessage.fs.c++" +#endif // Aurora Sim const U32 LAYER_FLAG = 2; @@ -99,6 +102,9 @@ void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name, const std::string& callback_url, bool teleport) // immediately teleport when result returned { +#ifdef OPENSIM + if (hypergrid_sendExactNamedRegionRequest(region_name, callback, callback_url, teleport)) return; +#endif //LL_INFOS("WorldMap") << LL_ENDL; mSLURLRegionName = region_name; mSLURLRegionHandle = 0; @@ -161,6 +167,10 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); +#ifdef OPENSIM + if (agent_flags != LAYER_FLAG && hypergrid_processExactNamedRegionResponse(msg, agent_flags)) return; +#endif + // There's only one flag that we ever use here if (agent_flags != LAYER_FLAG) { diff --git a/indra/newview/llworldmapmessage.fs.c++ b/indra/newview/llworldmapmessage.fs.c++ new file mode 100644 index 0000000000..5fc4d02415 --- /dev/null +++ b/indra/newview/llworldmapmessage.fs.c++ @@ -0,0 +1,185 @@ +// potential workaround for hop://grid:port/Partial/x/y/z resolution +// 2024.04.30 humbletim + +// notes: +// - exact MapNameRequests are sent flagless here (not using LAYER_FLAG) +// - this is to avoid triggering OpenSim code paths that modify result names +// - only affects LLWorldMapMessage->sendNamedRegionRequest(name, callback, ...) +// - in particular where a grid hosts overlapping names, hop Region matching may work better + + +#include "llworldmapmessage.fs.h" + +#include +#include + +#include "llagent.h" +#include "llcommon.h" +#include "llsingleton.h" +#include "llworldmap.h" // grid_to_region_handle +#include "llworldmapmessage.h" +#include "message.h" + +#include "llnotificationsutil.h" + +#define htxhop_log(format, ...) \ + { \ + fprintf(stderr, format "\n", __VA_ARGS__); \ + fflush(stderr); \ + LLNotificationsUtil::add("ChatSystemMessageTip", LLSD().with("MESSAGE", llformat(format, __VA_ARGS__))); \ + LL_WARNS("GridManager") << llformat(format, __VA_ARGS__) << LL_ENDL; \ + } + +#include "llviewercontrol.h" + +inline std::string extract_region(std::string const& s) +{ + static auto const& patterns = { + std::regex { R"(/ ([^/:=]+)$)" }, // TODO: figure out where the spec lives for hop "slash space" embedding... + std::regex { R"(([^/:=]+)$)" }, // TODO: figure out where the spec lives for hop "grid:port:region" embedding... + }; + std::smatch match_results; + std::string ls { s }; + LLStringUtil::toLower(ls); + for (auto const& pattern : patterns) { + if (std::regex_search(ls, match_results, pattern)) { + return match_results[1].str(); + } + } + return {}; +} +// int main() { +// for (const auto& s : { +// "http://hg.osgrid.org:80/ Vue North", +// "hop://hg.osgrid.org:80/ Vue North", +// "hg.osgrid.org:80/ Vue North", +// "hg.osgrid.org:80:Vue North", +// "hg.osgrid.org:80/Vue North", +// }) fprintf(stderr, "'%s' = '%s'\n", s, extract_region(s).c_str());fflush(stderr); +// return 0; +// } + +static LLCachedControl htxhop_flags(gSavedSettings, "htxhop_flags", 0, "default: 0\nLAYER_FLAG: 2\n"); +#define htxhop_debug_setting_disable (+htxhop_flags == 2) + +// helper to encapsulate Region Map Block responses +struct _MapBlock { + S32 index {}; + U16 x_regions {}, y_regions {}, x_size { REGION_WIDTH_UNITS }, y_size { REGION_WIDTH_UNITS }; + std::string name {}; + U8 accesscode {}; + U32 region_flags {}; + LLUUID image_id {}; + + inline U32 x_world() const { return (U32)(x_regions)*REGION_WIDTH_UNITS; } + inline U32 y_world() const { return (U32)(y_regions)*REGION_WIDTH_UNITS; } + inline U64 region_handle() const { return grid_to_region_handle(x_regions, y_regions); } + + // see: LLWorldMapMessage::processMapBlockReply + _MapBlock(LLMessageSystem* msg, S32 block) + : index(block) + { + msg->getU16Fast(_PREHASH_Data, _PREHASH_X, x_regions, block); + msg->getU16Fast(_PREHASH_Data, _PREHASH_Y, y_regions, block); + msg->getStringFast(_PREHASH_Data, _PREHASH_Name, name, block); + msg->getU8Fast(_PREHASH_Data, _PREHASH_Access, accesscode, block); + msg->getU32Fast(_PREHASH_Data, _PREHASH_RegionFlags, region_flags, block); + // msg->getU8Fast(_PREHASH_Data, _PREHASH_WaterHeight, water_height, block); + // msg->getU8Fast(_PREHASH_Data, _PREHASH_Agents, agents, block); + msg->getUUIDFast(_PREHASH_Data, _PREHASH_MapImageID, image_id, block); + // Aurora Sim + if (msg->getNumberOfBlocksFast(_PREHASH_Size) > 0) { + msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeX, x_size, block); + msg->getU16Fast(_PREHASH_Size, _PREHASH_SizeY, y_size, block); + } + if (x_size == 0 || (x_size % 16) != 0 || (y_size % 16) != 0) { + x_size = 256; + y_size = 256; + } + // Aurora Sim + } +}; + +#define EXACT_FLAG 0x00000000 + +// see: LLWorldMapMessage::sendNamedRegionRequest +void _hypergrid_sendMapNameRequest(std::string const& region_name, U32 flags) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_MapNameRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addU32Fast(_PREHASH_Flags, flags); + msg->addU32Fast(_PREHASH_EstateID, 0); // Filled in on sim + msg->addBOOLFast(_PREHASH_Godlike, FALSE); // Filled in on sim + msg->nextBlockFast(_PREHASH_NameData); + msg->addStringFast(_PREHASH_Name, region_name); + gAgent.sendReliableMessage(); +} + +using url_callback_t = std::function; +struct _AdoptedRegionNameQuery { + std::string key; + std::string region_name; + url_callback_t arbitrary_callback; + std::string arbitrary_slurl; + bool arbitrary_teleport; +}; +// map extracted region names => pending query entries +static std::map _region_name_queries; + +bool hypergrid_sendExactNamedRegionRequest(std::string const& region_name, url_callback_t const& callback, std::string const& callback_url, + bool teleport) +{ + if (htxhop_debug_setting_disable || !callback) + return false; + auto key = extract_region(region_name); + if (key.empty()) + return false; + _region_name_queries[key] = { key, region_name, callback, callback_url, teleport }; + htxhop_log("[xxHTxx] Send Region Name '%s' (key: %s)", region_name.c_str(), key.c_str()); + _hypergrid_sendMapNameRequest(region_name, EXACT_FLAG); + return true; +} + +bool hypergrid_processExactNamedRegionResponse(LLMessageSystem* msg, U32 agent_flags) +{ + if (htxhop_debug_setting_disable || !msg) + return false; + // NOTE: we assume only agent_flags have been read from msg so far + S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data); + + std::vector<_MapBlock> blocks; + blocks.reserve(num_blocks); + for (int b = 0; b < num_blocks; b++) { + blocks.emplace_back(msg, b); + } + /* EXPIRE:>=2024-05-10 */ for (auto const& _block : blocks) + htxhop_log("#%02d key='%s' block.name='%s' block.region_handle=%llu", _block.index, extract_region(_block.name).c_str(), + _block.name.c_str(), _block.region_handle()); + + // special case: handle singular result w/empty name tho valid region handle AND singular pending query as a match + // (might be that a landing area / redirect hop URL is coming back: "^hop://grid:port/$", which extract_region's into "") + bool solo_result = blocks.size() == 2 && blocks[0].region_handle() && extract_region(blocks[0].name).empty() && !blocks[1].region_handle(); + if (solo_result && _region_name_queries.size() == 1) { + htxhop_log("applying first block as redirect; region_handle: %llu", blocks[0].region_handle()); + blocks[0].name = _region_name_queries.begin()->second.region_name; + } + + for (auto const& _block : blocks) { + auto key = extract_region(_block.name); + if (key.empty()) + continue; + auto idx = _region_name_queries.find(key); + if (idx == _region_name_queries.end()) + continue; + auto pending = idx->second; + htxhop_log("[xxHTxx] Recv Region Name '%s' (key: %s) block.name='%s' block.region_handle=%llu)", pending.region_name.c_str(), + pending.key.c_str(), _block.name.c_str(), _block.region_handle()); + _region_name_queries.erase(idx); + pending.arbitrary_callback(_block.region_handle(), pending.arbitrary_slurl, _block.image_id, pending.arbitrary_teleport); + return true; + } + return false; +} diff --git a/indra/newview/llworldmapmessage.fs.h b/indra/newview/llworldmapmessage.fs.h new file mode 100644 index 0000000000..22a54dc00f --- /dev/null +++ b/indra/newview/llworldmapmessage.fs.h @@ -0,0 +1,13 @@ +// NOTE: optional header file in case wanting to integrate as .h/.cpp +#pragma once +#include +#include +#include +class LLMessageSystem; +class LLUUID; +bool hypergrid_sendExactNamedRegionRequest( + std::string const& region_name, + std::function const& callback, + std::string const& callback_url, + bool teleport); +bool hypergrid_processExactNamedRegionResponse(LLMessageSystem* msg, uint32_t agent_flags); From 61f7c7e08f4eb0104cd0185c9fe656e7b48c84d1 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 27 May 2024 15:25:06 -0400 Subject: [PATCH 2/4] cleanup; refactor code units per CR feedback --- indra/newview/CMakeLists.txt | 2 + ...apmessage.fs.c++ => fsworldmapmessage.cpp} | 55 ++++++------------- ...rldmapmessage.fs.h => fsworldmapmessage.h} | 11 +++- indra/newview/llworldmapmessage.cpp | 22 +++++--- 4 files changed, 42 insertions(+), 48 deletions(-) rename indra/newview/{llworldmapmessage.fs.c++ => fsworldmapmessage.cpp} (76%) rename indra/newview/{llworldmapmessage.fs.h => fsworldmapmessage.h} (78%) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 54b9fa09be..f82e724340 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -167,6 +167,7 @@ set(viewer_SOURCE_FILES fsscriptlibrary.cpp fsscrolllistctrl.cpp fsslurlcommand.cpp + fsworldmapmessage.cpp groupchatlistener.cpp lggbeamcolormapfloater.cpp lggbeammapfloater.cpp @@ -960,6 +961,7 @@ set(viewer_HEADER_FILES fsscrolllistctrl.h fsslurl.h fsslurlcommand.h + fsworldmapmessage.h groupchatlistener.h llaccountingcost.h lggbeamcolormapfloater.h diff --git a/indra/newview/llworldmapmessage.fs.c++ b/indra/newview/fsworldmapmessage.cpp similarity index 76% rename from indra/newview/llworldmapmessage.fs.c++ rename to indra/newview/fsworldmapmessage.cpp index 5fc4d02415..14aa758d51 100644 --- a/indra/newview/llworldmapmessage.fs.c++ +++ b/indra/newview/fsworldmapmessage.cpp @@ -8,29 +8,19 @@ // - in particular where a grid hosts overlapping names, hop Region matching may work better -#include "llworldmapmessage.fs.h" +#include "fsworldmapmessage.h" #include #include -#include "llagent.h" #include "llcommon.h" +#include "llagent.h" #include "llsingleton.h" #include "llworldmap.h" // grid_to_region_handle #include "llworldmapmessage.h" #include "message.h" -#include "llnotificationsutil.h" - -#define htxhop_log(format, ...) \ - { \ - fprintf(stderr, format "\n", __VA_ARGS__); \ - fflush(stderr); \ - LLNotificationsUtil::add("ChatSystemMessageTip", LLSD().with("MESSAGE", llformat(format, __VA_ARGS__))); \ - LL_WARNS("GridManager") << llformat(format, __VA_ARGS__) << LL_ENDL; \ - } - -#include "llviewercontrol.h" +#define htxhop_log(format, ...) LL_DEBUGS("GridManager") << llformat(format, __VA_ARGS__) << LL_ENDL; inline std::string extract_region(std::string const& s) { @@ -48,19 +38,6 @@ inline std::string extract_region(std::string const& s) } return {}; } -// int main() { -// for (const auto& s : { -// "http://hg.osgrid.org:80/ Vue North", -// "hop://hg.osgrid.org:80/ Vue North", -// "hg.osgrid.org:80/ Vue North", -// "hg.osgrid.org:80:Vue North", -// "hg.osgrid.org:80/Vue North", -// }) fprintf(stderr, "'%s' = '%s'\n", s, extract_region(s).c_str());fflush(stderr); -// return 0; -// } - -static LLCachedControl htxhop_flags(gSavedSettings, "htxhop_flags", 0, "default: 0\nLAYER_FLAG: 2\n"); -#define htxhop_debug_setting_disable (+htxhop_flags == 2) // helper to encapsulate Region Map Block responses struct _MapBlock { @@ -132,21 +109,24 @@ static std::map _region_name_queries; bool hypergrid_sendExactNamedRegionRequest(std::string const& region_name, url_callback_t const& callback, std::string const& callback_url, bool teleport) { - if (htxhop_debug_setting_disable || !callback) + if (!callback) { return false; + } auto key = extract_region(region_name); - if (key.empty()) + if (key.empty()) { return false; + } _region_name_queries[key] = { key, region_name, callback, callback_url, teleport }; - htxhop_log("[xxHTxx] Send Region Name '%s' (key: %s)", region_name.c_str(), key.c_str()); + htxhop_log("Send Region Name '%s' (key: %s)", region_name.c_str(), key.c_str()); _hypergrid_sendMapNameRequest(region_name, EXACT_FLAG); return true; } bool hypergrid_processExactNamedRegionResponse(LLMessageSystem* msg, U32 agent_flags) { - if (htxhop_debug_setting_disable || !msg) + if (!msg) { return false; + } // NOTE: we assume only agent_flags have been read from msg so far S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_Data); @@ -155,10 +135,9 @@ bool hypergrid_processExactNamedRegionResponse(LLMessageSystem* msg, U32 agent_f for (int b = 0; b < num_blocks; b++) { blocks.emplace_back(msg, b); } - /* EXPIRE:>=2024-05-10 */ for (auto const& _block : blocks) - htxhop_log("#%02d key='%s' block.name='%s' block.region_handle=%llu", _block.index, extract_region(_block.name).c_str(), - _block.name.c_str(), _block.region_handle()); - + for (auto const& _block : blocks) { + htxhop_log("#%02d key='%s' block.name='%s' block.region_handle=%llu", _block.index, extract_region(_block.name).c_str(), _block.name.c_str(), _block.region_handle()); + } // special case: handle singular result w/empty name tho valid region handle AND singular pending query as a match // (might be that a landing area / redirect hop URL is coming back: "^hop://grid:port/$", which extract_region's into "") bool solo_result = blocks.size() == 2 && blocks[0].region_handle() && extract_region(blocks[0].name).empty() && !blocks[1].region_handle(); @@ -169,13 +148,15 @@ bool hypergrid_processExactNamedRegionResponse(LLMessageSystem* msg, U32 agent_f for (auto const& _block : blocks) { auto key = extract_region(_block.name); - if (key.empty()) + if (key.empty()) { continue; + } auto idx = _region_name_queries.find(key); - if (idx == _region_name_queries.end()) + if (idx == _region_name_queries.end()) { continue; + } auto pending = idx->second; - htxhop_log("[xxHTxx] Recv Region Name '%s' (key: %s) block.name='%s' block.region_handle=%llu)", pending.region_name.c_str(), + htxhop_log("Recv Region Name '%s' (key: %s) block.name='%s' block.region_handle=%llu)", pending.region_name.c_str(), pending.key.c_str(), _block.name.c_str(), _block.region_handle()); _region_name_queries.erase(idx); pending.arbitrary_callback(_block.region_handle(), pending.arbitrary_slurl, _block.image_id, pending.arbitrary_teleport); diff --git a/indra/newview/llworldmapmessage.fs.h b/indra/newview/fsworldmapmessage.h similarity index 78% rename from indra/newview/llworldmapmessage.fs.h rename to indra/newview/fsworldmapmessage.h index 22a54dc00f..8bbd7ba9e0 100644 --- a/indra/newview/llworldmapmessage.fs.h +++ b/indra/newview/fsworldmapmessage.h @@ -1,5 +1,10 @@ -// NOTE: optional header file in case wanting to integrate as .h/.cpp -#pragma once +/* + * @file fsworldmapmessage.h + */ + +#ifndef FS_WORLDMAPMESSAGE_H +#define FS_WORLDMAPMESSAGE_H + #include #include #include @@ -11,3 +16,5 @@ bool hypergrid_sendExactNamedRegionRequest( std::string const& callback_url, bool teleport); bool hypergrid_processExactNamedRegionResponse(LLMessageSystem* msg, uint32_t agent_flags); + +#endif // FS_WORLDMAPMESSAGE_H diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp index c0ddd453dd..879fc245df 100644 --- a/indra/newview/llworldmapmessage.cpp +++ b/indra/newview/llworldmapmessage.cpp @@ -35,10 +35,8 @@ // Aurora Sim #include "llviewernetwork.h" -#ifdef OPENSIM -#include "llworldmapmessage.fs.c++" -#endif // Aurora Sim +#include "fsworldmapmessage.h" // FIRE-31368: [OPENSIM] ... Search returns more than one result const U32 LAYER_FLAG = 2; @@ -102,9 +100,12 @@ void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name, const std::string& callback_url, bool teleport) // immediately teleport when result returned { -#ifdef OPENSIM - if (hypergrid_sendExactNamedRegionRequest(region_name, callback, callback_url, teleport)) return; -#endif + // FIRE-31368: [OPENSIM] ... Search returns more than one result + if (hypergrid_sendExactNamedRegionRequest(region_name, callback, callback_url, teleport)) { + return; + } + // + //LL_INFOS("WorldMap") << LL_ENDL; mSLURLRegionName = region_name; mSLURLRegionHandle = 0; @@ -167,9 +168,12 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); -#ifdef OPENSIM - if (agent_flags != LAYER_FLAG && hypergrid_processExactNamedRegionResponse(msg, agent_flags)) return; -#endif + // FIRE-31368: [OPENSIM] ... Search returns more than one result + if (hypergrid_processExactNamedRegionResponse(msg, agent_flags)) { + return; + } + // + // There's only one flag that we ever use here if (agent_flags != LAYER_FLAG) From 2d59292228c4cd6b2550cce89700bbb7c55c31bf Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 27 May 2024 18:33:58 -0400 Subject: [PATCH 3/4] prefer constexpr over defines; add runtime isInOpenSim check --- indra/newview/fsworldmapmessage.cpp | 8 +++++--- indra/newview/llworldmapmessage.cpp | 4 ---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/indra/newview/fsworldmapmessage.cpp b/indra/newview/fsworldmapmessage.cpp index 14aa758d51..7e4ee41ac7 100644 --- a/indra/newview/fsworldmapmessage.cpp +++ b/indra/newview/fsworldmapmessage.cpp @@ -17,6 +17,7 @@ #include "llagent.h" #include "llsingleton.h" #include "llworldmap.h" // grid_to_region_handle +#include "fsgridhandler.h" #include "llworldmapmessage.h" #include "message.h" @@ -77,7 +78,8 @@ struct _MapBlock { } }; -#define EXACT_FLAG 0x00000000 +constexpr U32 EXACT_FLAG = 0x00000000; +constexpr U32 LAYER_FLAG = 0x00000002; // see: LLWorldMapMessage::sendNamedRegionRequest void _hypergrid_sendMapNameRequest(std::string const& region_name, U32 flags) @@ -109,7 +111,7 @@ static std::map _region_name_queries; bool hypergrid_sendExactNamedRegionRequest(std::string const& region_name, url_callback_t const& callback, std::string const& callback_url, bool teleport) { - if (!callback) { + if (!LLGridManager::instance().isInOpenSim() || !callback) { return false; } auto key = extract_region(region_name); @@ -124,7 +126,7 @@ bool hypergrid_sendExactNamedRegionRequest(std::string const& region_name, url_c bool hypergrid_processExactNamedRegionResponse(LLMessageSystem* msg, U32 agent_flags) { - if (!msg) { + if (!LLGridManager::instance().isInOpenSim() || !msg || agent_flags & LAYER_FLAG) { return false; } // NOTE: we assume only agent_flags have been read from msg so far diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp index 879fc245df..6c61da7e96 100644 --- a/indra/newview/llworldmapmessage.cpp +++ b/indra/newview/llworldmapmessage.cpp @@ -105,7 +105,6 @@ void LLWorldMapMessage::sendNamedRegionRequest(std::string region_name, return; } // - //LL_INFOS("WorldMap") << LL_ENDL; mSLURLRegionName = region_name; mSLURLRegionHandle = 0; @@ -167,14 +166,11 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) } U32 agent_flags; msg->getU32Fast(_PREHASH_AgentData, _PREHASH_Flags, agent_flags); - // FIRE-31368: [OPENSIM] ... Search returns more than one result if (hypergrid_processExactNamedRegionResponse(msg, agent_flags)) { return; } // - - // There's only one flag that we ever use here if (agent_flags != LAYER_FLAG) { From 6f325f91d7e3ab62ba364445a1d1bb8ba9ca2499 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 27 May 2024 18:40:30 -0400 Subject: [PATCH 4/4] +-newline --- indra/newview/llworldmapmessage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp index 6c61da7e96..5376a7fc8f 100644 --- a/indra/newview/llworldmapmessage.cpp +++ b/indra/newview/llworldmapmessage.cpp @@ -171,6 +171,7 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) return; } // + // There's only one flag that we ever use here if (agent_flags != LAYER_FLAG) {