From f849abc386d4dbd17fb484df568e6d24a15fa078 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 7 Dec 2019 08:45:04 +0100 Subject: [PATCH] find missing unlock --- src/cpp/SingletonManager/SessionManager.cpp | 2 +- src/cpp/model/Session.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cpp/SingletonManager/SessionManager.cpp b/src/cpp/SingletonManager/SessionManager.cpp index c2cf30345..83719d04b 100644 --- a/src/cpp/SingletonManager/SessionManager.cpp +++ b/src/cpp/SingletonManager/SessionManager.cpp @@ -339,7 +339,7 @@ void SessionManager::checkTimeoutSession() Poco::Mutex::ScopedLock _lock(mWorkingMutex, 500); } catch (Poco::TimeoutException &ex) { - printf("[SessionManager::checkTimeoutSession] exception timout mutex: %s\n", ex.displayText().data()); + printf("[SessionManager::checkTimeoutSession] exception timeout mutex: %s\n", ex.displayText().data()); return; } //mWorkingMutex.lock(); diff --git a/src/cpp/model/Session.cpp b/src/cpp/model/Session.cpp index 677191f86..f509636a1 100644 --- a/src/cpp/model/Session.cpp +++ b/src/cpp/model/Session.cpp @@ -239,7 +239,7 @@ bool Session::createUser(const std::string& first_name, const std::string& last_ bool Session::updateEmailVerification(Poco::UInt64 emailVerificationCode) { - + lock("Session::updateEmailVerification"); Profiler usedTime; const static char* funcName = "Session::updateEmailVerification"; auto em = ErrorManager::getInstance(); @@ -270,7 +270,7 @@ bool Session::updateEmailVerification(Poco::UInt64 emailVerificationCode) } updateState(SESSION_STATE_EMAIL_VERIFICATION_CODE_CHECKED); //printf("[%s] time: %s\n", funcName, usedTime.string().data()); - + unlock(); return true; } else { @@ -280,6 +280,7 @@ bool Session::updateEmailVerification(Poco::UInt64 emailVerificationCode) if (!updated_rows) { addError(new Error(gettext("E-Mail Verification"), gettext("Der Code stimmt nicht, bitte überprüfe ihn nochmal oder registriere dich erneut oder wende dich an den Server-Admin"))); printf("[%s] time: %s\n", funcName, usedTime.string().data()); + unlock(); return false; } @@ -287,9 +288,11 @@ bool Session::updateEmailVerification(Poco::UInt64 emailVerificationCode) else { addError(new Error(gettext("E-Mail Verification"), gettext("Falscher Code für aktiven Login"))); printf("[%s] time: %s\n", funcName, usedTime.string().data()); + unlock(); return false; } //printf("[%s] time: %s\n", funcName, usedTime.string().data()); + unlock(); return false; } @@ -412,6 +415,7 @@ UserStates Session::loadUser(const std::string& email, const std::string& passwo } if (mSessionUser->getUserState() >= USER_LOADED_FROM_DB) { if (!mSessionUser->validatePwd(password, this)) { + unlock(); return USER_PASSWORD_INCORRECT; } } @@ -620,7 +624,7 @@ void Session::updateState(SessionStates newState) const char* Session::getSessionStateString() { SessionStates state; - lock(" Session::getSessionStateString"); + lock("Session::getSessionStateString"); state = mState; unlock(); return translateSessionStateToString(state);