From 950eb9808b1e6212a6624709ebb003d9f1815fb8 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 28 Sep 2013 13:05:59 -0700 Subject: Apply the load speed hack to the login server, too --- src/login/login.cpp | 18 +++++++++++++----- 1 file 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 #include #include +#include #include #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 seen_ids; + static std::set 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 -- cgit v1.2.3-60-g2f50