From 1b3a914d5fdf5a578e24754845c6350c59c0b523 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 29 Sep 2009 18:12:59 +0200 Subject: Fixed some UserListManager-related bugs --- .../Requests/UserLists/UserListUploadRequest.cpp | 5 ++++- src/Common/ClientConnection.cpp | 1 + src/Server/UserListManager.cpp | 18 +++++++++--------- src/Server/UserListManager.h | 21 +++------------------ 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/Client/Requests/UserLists/UserListUploadRequest.cpp b/src/Client/Requests/UserLists/UserListUploadRequest.cpp index 28251d8..8ac9ab6 100644 --- a/src/Client/Requests/UserLists/UserListUploadRequest.cpp +++ b/src/Client/Requests/UserLists/UserListUploadRequest.cpp @@ -46,6 +46,8 @@ void UserListUploadRequest::handlePacket(boost::shared_ptrgetType() != "Continue") { signalFinished(Core::Exception(Core::Exception::UNEXPECTED_PACKET)); @@ -53,10 +55,11 @@ void UserListUploadRequest::handlePacket(boost::shared_ptrget("exists")) { + canceled = true; + Common::XmlData ret; ret.setType("Cancel"); sendPacket(ret); - canceled = true; return; } diff --git a/src/Common/ClientConnection.cpp b/src/Common/ClientConnection.cpp index db6efb2..91327e2 100644 --- a/src/Common/ClientConnection.cpp +++ b/src/Common/ClientConnection.cpp @@ -26,6 +26,7 @@ namespace Common { ClientConnection::ClientConnection(Core::Application *application) : Connection(application), connection(Net::ClientConnection::create(application)) { connection->connectSignalReceive(boost::bind(&ClientConnection::receive, this, _1)); + connection->setReceiveLimit(0xFFFFFFFF); // TODO Authentication? } ClientConnection::~ClientConnection() { diff --git a/src/Server/UserListManager.cpp b/src/Server/UserListManager.cpp index 04ba7d2..8e524a0 100644 --- a/src/Server/UserListManager.cpp +++ b/src/Server/UserListManager.cpp @@ -34,24 +34,20 @@ namespace Mad { namespace Server { UserListManager::UserListManager(Application *application0) : application(application0), requestHandlerGroup(new RequestHandlers::UserListRequestHandlerGroup(application)) { - application->getConfigManager()->registerConfigurable(this); + application->getRequestManager()->registerRequestHandlerGroup(requestHandlerGroup); + application->getRequestManager()->registerPacketType("UploadUserList"); + application->getRequestManager()->registerPacketType("UploadUserListDiff"); } UserListManager::~UserListManager() { application->getRequestManager()->unregisterPacketType("UploadUserList"); application->getRequestManager()->unregisterPacketType("UploadUserListDiff"); application->getRequestManager()->unregisterRequestHandlerGroup(requestHandlerGroup); - application->getConfigManager()->unregisterConfigurable(this); } -void UserListManager::configure() { - userLists = application->getStorageManager()->list("UserList"); - userListDiffs = application->getStorageManager()->list("UserListDiff"); - - application->getRequestManager()->registerRequestHandlerGroup(requestHandlerGroup); - application->getRequestManager()->registerPacketType("UploadUserList"); - application->getRequestManager()->registerPacketType("UploadUserListDiff"); +std::set UserListManager::getUserLists() { + return application->getStorageManager()->list("UserList"); } bool UserListManager::existsUserList(const Core::String &name) { @@ -87,6 +83,10 @@ void UserListManager::removeUserList(const Core::String &name) { } +std::set UserListManager::getUserListDiffs() { + return application->getStorageManager()->list("UserListDiff"); +} + bool UserListManager::existsUserListDiff(const Core::String &name) { return application->getStorageManager()->exists("UserListDiff", name); } diff --git a/src/Server/UserListManager.h b/src/Server/UserListManager.h index bb5b4e3..0c2ef69 100644 --- a/src/Server/UserListManager.h +++ b/src/Server/UserListManager.h @@ -22,7 +22,6 @@ #include "export.h" -#include #include #include @@ -47,28 +46,17 @@ namespace RequestHandlers { class UserListRequestHandlerGroup; } -class MAD_SERVER_EXPORT UserListManager : private Core::Configurable, private boost::noncopyable { +class MAD_SERVER_EXPORT UserListManager : private boost::noncopyable { private: Application *application; boost::shared_ptr requestHandlerGroup; - std::set userLists; - std::set userListDiffs; - - protected: - virtual void configure(); - public: - virtual int getPriority() const {return -1;} - UserListManager(Application *application0); virtual ~UserListManager(); - const std::set& getUserLists() const { - return userLists; - } - + std::set getUserLists(); bool existsUserList(const Core::String &name); boost::shared_ptr loadUserList(const Core::String &name); void storeUserList(const Core::String &name, const Common::UserLists::UserList *list); @@ -76,10 +64,7 @@ class MAD_SERVER_EXPORT UserListManager : private Core::Configurable, private bo void renameUserList(const Core::String &fromName, const Core::String &toName); void removeUserList(const Core::String &name); - const std::set& getUserListDiffs() const { - return userListDiffs; - } - + std::set getUserListDiffs(); bool existsUserListDiff(const Core::String &name); boost::shared_ptr loadUserListDiff(const Core::String &name); void storeUserListDiff(const Core::String &name, const Common::UserLists::UserListDiff *list); -- cgit v1.2.3