diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-09-28 13:05:59 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-09-28 13:08:38 -0700 |
commit | 950eb9808b1e6212a6624709ebb003d9f1815fb8 (patch) | |
tree | 99a0cba415e6cc97f8b62382fc2646af955e4da8 | |
parent | 0f047d29c20d1910acd363e45f5b988ca750947b (diff) | |
download | tmwa-950eb9808b1e6212a6624709ebb003d9f1815fb8.tar.gz tmwa-950eb9808b1e6212a6624709ebb003d9f1815fb8.tar.bz2 tmwa-950eb9808b1e6212a6624709ebb003d9f1815fb8.tar.xz tmwa-950eb9808b1e6212a6624709ebb003d9f1815fb8.zip |
Apply the load speed hack to the login server, too
-rw-r--r-- | src/login/login.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/login/login.cpp b/src/login/login.cpp index 8d79158..342de5d 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -12,6 +12,7 @@ #include <algorithm> #include <array> #include <fstream> +#include <set> #include <type_traits> #include "../common/core.hpp" @@ -471,12 +472,19 @@ bool extract(XString line, AuthData *ad) return false; if (ad->account_id > END_ACCOUNT_NUM) return false; - for (const AuthData& adi : auth_data) + // TODO replace *every* lookup with a map lookup + static std::set<int> seen_ids; + static std::set<AccountName> seen_names; + // we don't have to worry about deleted characters, + // this is only called during startup + auto _seen_id = seen_ids.insert(ad->account_id); + if (!_seen_id.second) + return false; + auto _seen_name = seen_names.insert(ad->userid); + if (!_seen_name.second) { - if (adi.account_id == ad->account_id) - return false; - if (adi.userid == ad->userid) - return false; + seen_ids.erase(_seen_id.first); + return false; } // If a password is not encrypted, we encrypt it now. // A password beginning with ! and - in the memo field is our magic |