diff options
author | Oz Linden <oz@lindenlab.com> | 2012-07-02 11:14:13 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2012-07-02 11:14:13 -0400 |
commit | 770d8b0d01d3dabeccded0df3a06058f6196d829 (patch) | |
tree | 777efc076d2560cf80f183728443a5cbb147ca7d | |
parent | a6fab91181362c1a5d616c84c78901f61c86228c (diff) |
improve logging of invalid grid definitions, prevent clashes with old viewers
-rw-r--r-- | indra/newview/llviewernetwork.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llviewernetwork.h | 5 | ||||
-rw-r--r-- | indra/newview/tests/lllogininstance_test.cpp | 3 | ||||
-rw-r--r-- | indra/newview/tests/llslurl_test.cpp | 4 | ||||
-rw-r--r-- | indra/newview/tests/llviewernetwork_test.cpp | 8 |
5 files changed, 23 insertions, 27 deletions
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index 0382d837fa..97f4c3e5fe 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -36,7 +36,7 @@ /// key used to store the grid, and the name attribute in the grid data -const std::string GRID_VALUE = "name"; +const std::string GRID_VALUE = "keyname"; /// the value displayed in the grid selector menu, and other human-oriented text const std::string GRID_LABEL_VALUE = "label"; /// the value used on the --grid command line argument @@ -154,15 +154,13 @@ void LLGridManager::initialize(const std::string& grid_file) { LL_WARNS("GridManager") << "Cannot override existing grid '" << key_name << "'; ignoring definition from '"<<grid_file<<"'" << LL_ENDL; } + else if ( addGrid(grid) ) + { + LL_INFOS("GridManager") << "added grid '"<<key_name<<"'"<<LL_ENDL; + } else { - try - { - addGrid(grid); // does all the logging that's needed - } - catch (...) - { - } + LL_WARNS("GridManager") << "failed to add invalid grid '"<<key_name<<"'"<<LL_ENDL; } } llsd_xml.close(); @@ -245,8 +243,9 @@ LLGridManager::~LLGridManager() // if they're not populated yet. // -void LLGridManager::addGrid(LLSD& grid_data) +bool LLGridManager::addGrid(LLSD& grid_data) { + bool added = false; if (grid_data.isMap() && grid_data.has(GRID_VALUE)) { std::string grid = utf8str_tolower(grid_data[GRID_VALUE].asString()); @@ -307,6 +306,7 @@ void LLGridManager::addGrid(LLSD& grid_data) } LL_CONT << LL_ENDL; mGridList[grid] = grid_data; + added = true; } else { @@ -320,8 +320,9 @@ void LLGridManager::addGrid(LLSD& grid_data) } else { - LL_WARNS("GridManager")<<"invalid value passed"<<LL_ENDL; + LL_WARNS("GridManager")<<"invalid grid definition ignored"<<LL_ENDL; } + return added; } // @@ -362,6 +363,7 @@ void LLGridManager::addSystemGrid(const std::string& label, { grid[GRID_SLURL_BASE] = llformat(SYSTEM_GRID_SLURL_BASE, grid[GRID_ID_VALUE].asString().c_str()); } + addGrid(grid); } @@ -427,14 +429,6 @@ std::string LLGridManager::getGrid( const std::string &grid ) } } } - if (grid_name.empty()) - { - LL_WARNS("GridManager")<<"No name found for grid '"<<grid<<"'"<<LL_ENDL; - } - else - { - LL_DEBUGS("GridManager")<<"grid '"<<grid<<"' name is '"<<grid_name<<"'"<<LL_ENDL; - } return grid_name; } diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h index 802badd494..8c4990f8fe 100644 --- a/indra/newview/llviewernetwork.h +++ b/indra/newview/llviewernetwork.h @@ -195,8 +195,9 @@ class LLGridManager : public LLSingleton<LLGridManager> private: - /// Add a grid to the list of grids - void addGrid(LLSD& grid_info); + /// Add a grid to the list of grids + bool addGrid(LLSD& grid_info); + ///< @returns true if successfully added /// find the LLSD definition for a given grid void getGridInfo(const std::string& grid, LLSD &grid_info); diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index c9f49d9343..b7e81c4199 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -114,8 +114,9 @@ LLGridManager::~LLGridManager() { } -void LLGridManager::addGrid(LLSD& grid_data) +bool LLGridManager::addGrid(LLSD& grid_data) { + return true; } LLGridManager::LLGridManager() : diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index f995d8f0f5..09343ef227 100644 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -93,7 +93,7 @@ const char *gSampleGridFile = " <array>" " <string>foobar/loginuri</string>" " </array>" - " <key>name</key><string>foo.bar.com</string>" + " <key>keyname</key><string>foo.bar.com</string>" " <key>credential_type</key><string>agent</string>" " <key>grid_login_id</key><string>FooBar</string>" " </map>" @@ -106,7 +106,7 @@ const char *gSampleGridFile = " <array>" " <string>mygrid/loginuri</string>" " </array>" - " <key>name</key><string>my.grid.com</string>" + " <key>keyname</key><string>my.grid.com</string>" " <key>credential_type</key><string>agent</string>" " <key>grid_login_id</key><string>MyGrid</string>" " </map>" diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index 43d3b6522e..a1e97ea17e 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -95,13 +95,13 @@ const char *gSampleGridFile = " <string>altgrid/myloginuri1</string>" " <string>altgrid/myloginuri2</string>" " </array>" - " <key>name</key><string>altgrid.long.name</string>" + " <key>keyname</key><string>altgrid.long.name</string>" " <key>credential_type</key><string>agent</string>" " <key>grid_login_id</key><string>AltGrid</string>" " </map>" " <key>minimal.long.name</key>" " <map>" - " <key>name</key><string>minimal.long.name</string>" + " <key>keyname</key><string>minimal.long.name</string>" " </map>" " <!-- Note that the values for agni and aditi below are deliberately" " incorrect to test that they are not overwritten -->" @@ -115,7 +115,7 @@ const char *gSampleGridFile = " <array>" " <string>myloginuri</string>" " </array>" - " <key>name</key><string>util.agni.lindenlab.com</string> <!-- conflict -->" + " <key>keyname</key><string>util.agni.lindenlab.com</string> <!-- conflict -->" " </map>" " <key>util.foobar.lindenlab.com</key>" " <map>" @@ -127,7 +127,7 @@ const char *gSampleGridFile = " <array>" " <string>myloginuri</string>" " </array>" - " <key>name</key><string>util.foobar.lindenlab.com</string>" + " <key>keyname</key><string>util.foobar.lindenlab.com</string>" " </map>" " </map>" "</llsd>" |