From bed43cf34883d5bf2681c50948e0ddf153846fbb Mon Sep 17 00:00:00 2001 From: David Athay Date: Fri, 21 Nov 2008 09:32:54 +0000 Subject: Added bandwidth monitor to account server. Fixes compile errors. --- src/Makefile.am | 2 ++ src/account-server/accounthandler.cpp | 2 +- src/account-server/dalstorage.cpp | 2 +- src/account-server/main-account.cpp | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 65e91710..c9e9b707 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -46,6 +46,8 @@ tmwserv_account_SOURCES = \ dal/dataproviderfactory.cpp \ dal/recordset.h \ dal/recordset.cpp \ + net/bandwidth.hpp \ + net/bandwidth.cpp \ net/connectionhandler.hpp \ net/connectionhandler.cpp \ net/messagein.hpp \ diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index 961f6f92..372fc678 100644 --- a/src/account-server/accounthandler.cpp +++ b/src/account-server/accounthandler.cpp @@ -333,7 +333,7 @@ static void handleRegisterMessage(AccountClient &computer, MessageIn &msg) acc->setPassword(sha256(username + password)); // We hash email server-side without using a salt. acc->setEmail(sha256(email)); - acc->setLevel(AL_NORMAL); + acc->setLevel(AL_PLAYER); // set the date and time of the account registration, and the last login time_t regdate; diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp index eca31321..06a1c83a 100644 --- a/src/account-server/dalstorage.cpp +++ b/src/account-server/dalstorage.cpp @@ -1302,7 +1302,7 @@ void DALStorage::checkBannedAccounts() // update expired bans std::ostringstream sql; sql << "update " << ACCOUNTS_TBL_NAME - << " set level = " << AL_NORMAL << ", banned = 0" + << " set level = " << AL_PLAYER << ", banned = 0" << " where level = " << AL_BANNED << " AND banned <= " << time(NULL) << ";"; mDb->execSql(sql.str()); diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp index e6a521cf..f2373d28 100644 --- a/src/account-server/main-account.cpp +++ b/src/account-server/main-account.cpp @@ -38,6 +38,7 @@ #include "chat-server/guildmanager.hpp" #include "chat-server/post.hpp" #include "common/configuration.hpp" +#include "net/bandwidth.hpp" #include "net/connectionhandler.hpp" #include "net/messageout.hpp" #include "utils/logger.h" @@ -69,6 +70,9 @@ GuildManager *guildManager; /** Post Manager */ PostManager *postalManager; +/** Bandwidth Monitor */ +BandwidthMonitor *gBandwidth; + /** Callback used when SIGQUIT signal is received. */ static void closeGracefully(int) { @@ -159,6 +163,8 @@ static void initialize() guildManager = new GuildManager; // Initialise the post manager postalManager = new PostManager; + // Initialise the bandwidth monitor + gBandwidth = new BandwidthMonitor; // --- Initialize the global handlers // FIXME: Make the global handlers global vars or part of a bigger @@ -201,6 +207,7 @@ static void deinitialize() delete chatChannelManager; delete guildManager; delete postalManager; + delete gBandwidth; // Get rid of persistent data storage delete storage; -- cgit v1.2.3-70-g09d2