From f0ee6ebd726ba7ed8195c8a98da31b51051d46c7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 31 Aug 2019 13:23:06 +0800 Subject: [PATCH] 1 --- server/gameserver/app.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/server/gameserver/app.cc b/server/gameserver/app.cc index 5f1669a..338a944 100755 --- a/server/gameserver/app.cc +++ b/server/gameserver/app.cc @@ -132,8 +132,43 @@ static void HttpTest() } } +static void test() +{ + { + std::map test_hash; + for (int i = 0; i < 10; ++i) { + test_hash[a8::XValue(i).GetString()] = a8::XValue(i).GetString(); + } + std::map test_hash_copy; + + bool combin_ok = false; + do { + combin_ok = false; + int i = 0; + for (auto& pair1 : test_hash) { + for (auto& pair2 : test_hash_copy) { + ++i; + if (i > 3) { + std::string t1 = pair1.first; + std::string t2 = pair2.first; + test_hash.erase(t1); + test_hash.erase(t2); + test_hash_copy.erase(t1); + test_hash_copy.erase(t2); + combin_ok = true; + break; + } + } + } + } while(combin_ok); + } +} + bool App::Init(int argc, char* argv[]) { + #if 0 + test(); + #endif signal(SIGPIPE, SIG_IGN); this->argc = argc; this->argv = argv;