From: Maxim Mamontov Date: Thu, 14 Nov 2013 20:01:45 +0000 (+0200) Subject: Merge branch 'log-unauth-reasons' X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/64b687f8ec36a103865044613cb0f42f98aeda3a?ds=sidebyside;hp=--cc Merge branch 'log-unauth-reasons' Conflicts: projects/stargazer/user_impl.cpp --- 64b687f8ec36a103865044613cb0f42f98aeda3a diff --cc projects/stargazer/user_impl.cpp index 13cf0b77,37178dd6..7b0348bc --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@@ -536,7 -555,7 +536,8 @@@ if (!authorizedBy.erase(auth) if (authorizedBy.empty()) { + authorizedModificationTime = stgTime; + lastDisconnectReason = reason; lastIPForDisconnect = currIP; currIP = 0; // DelUser in traffcounter return; diff --cc projects/stargazer/user_impl.h index 26ff58fc,6f6030ca..68945d2c --- a/projects/stargazer/user_impl.h +++ b/projects/stargazer/user_impl.h @@@ -184,11 -183,10 +184,12 @@@ public bool GetConnected() const { return connected; } time_t GetConnectedModificationTime() const { return connected.ModificationTime(); } + const std::string & GetLastDisconnectReason() const { return lastDisconnectReason; } int GetAuthorized() const { return static_cast(authorizedBy.size()); } + time_t GetAuthorizedModificationTime() const { return authorizedModificationTime; } int Authorize(uint32_t ip, uint32_t enabledDirs, const AUTH * auth); - void Unauthorize(const AUTH * auth); + void Unauthorize(const AUTH * auth, + const std::string & reason = std::string()); bool IsAuthorizedBy(const AUTH * auth) const; std::vector GetAuthorizers() const;