Move server configuration to dedicated server only. Separate error logging for client and server, in preparation of creating a log file on the dedicated server.
This commit is contained in:
+5
-1
@@ -95,6 +95,7 @@ HEADERS += \
|
|||||||
src/gamedata.h \
|
src/gamedata.h \
|
||||||
src/config/configfile.h \
|
src/config/configfile.h \
|
||||||
src/core/thread.h \
|
src/core/thread.h \
|
||||||
|
src/core/loghelper.h \
|
||||||
src/engine/boardinterface.h \
|
src/engine/boardinterface.h \
|
||||||
src/engine/enginefactory.h \
|
src/engine/enginefactory.h \
|
||||||
src/engine/handinterface.h \
|
src/engine/handinterface.h \
|
||||||
@@ -115,6 +116,7 @@ HEADERS += \
|
|||||||
src/net/socket_helper.h \
|
src/net/socket_helper.h \
|
||||||
src/net/socket_msg.h \
|
src/net/socket_msg.h \
|
||||||
src/net/socket_startup.h \
|
src/net/socket_startup.h \
|
||||||
|
src/net/net_helper.h \
|
||||||
src/core/tinyxml/tinystr.h \
|
src/core/tinyxml/tinystr.h \
|
||||||
src/core/tinyxml/tinyxml.h \
|
src/core/tinyxml/tinyxml.h \
|
||||||
src/engine/local_engine/cardsvalue.h \
|
src/engine/local_engine/cardsvalue.h \
|
||||||
@@ -221,7 +223,9 @@ SOURCES += \
|
|||||||
src/gui/qt/mymessagedialog/mymessagedialogimpl.cpp \
|
src/gui/qt/mymessagedialog/mymessagedialogimpl.cpp \
|
||||||
src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp \
|
src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp \
|
||||||
src/gui/qt/gamelobbydialog/mygamelisttreewidget.cpp \
|
src/gui/qt/gamelobbydialog/mygamelisttreewidget.cpp \
|
||||||
src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp
|
src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp \
|
||||||
|
src/net/common/net_helper_client.cpp \
|
||||||
|
src/core/common/loghelper_client.cpp
|
||||||
|
|
||||||
TRANSLATIONS = \
|
TRANSLATIONS = \
|
||||||
ts/pokerth_de.ts \
|
ts/pokerth_de.ts \
|
||||||
|
|||||||
+5
-1
@@ -75,10 +75,12 @@ HEADERS += \
|
|||||||
src/net/socket_helper.h \
|
src/net/socket_helper.h \
|
||||||
src/net/socket_msg.h \
|
src/net/socket_msg.h \
|
||||||
src/net/socket_startup.h \
|
src/net/socket_startup.h \
|
||||||
|
src/net/net_helper.h \
|
||||||
src/core/tinyxml/tinystr.h \
|
src/core/tinyxml/tinystr.h \
|
||||||
src/core/tinyxml/tinyxml.h \
|
src/core/tinyxml/tinyxml.h \
|
||||||
src/core/pokerthexception.h \
|
src/core/pokerthexception.h \
|
||||||
src/core/convhelper.h \
|
src/core/convhelper.h \
|
||||||
|
src/core/loghelper.h \
|
||||||
src/engine/local_engine/cardsvalue.h \
|
src/engine/local_engine/cardsvalue.h \
|
||||||
src/engine/local_engine/localboard.h \
|
src/engine/local_engine/localboard.h \
|
||||||
src/engine/local_engine/localenginefactory.h \
|
src/engine/local_engine/localenginefactory.h \
|
||||||
@@ -104,7 +106,9 @@ HEADERS += \
|
|||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/pokerth_server.cpp \
|
src/pokerth_server.cpp \
|
||||||
src/gui/qt/qttools/nonqttoolswrapper.cpp \
|
src/gui/qt/qttools/nonqttoolswrapper.cpp \
|
||||||
src/gui/qt/qttools/nonqthelper/nonqthelper.cpp
|
src/gui/qt/qttools/nonqthelper/nonqthelper.cpp \
|
||||||
|
src/net/common/net_helper_server.cpp \
|
||||||
|
src/core/common/loghelper_server.cpp
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
DEPENDPATH += src/net/win32/ src/core/win32
|
DEPENDPATH += src/net/win32/ src/core/win32
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "avatarmanager.h"
|
#include "avatarmanager.h"
|
||||||
|
#include <net/net_helper.h>
|
||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
#include <core/loghelper.h>
|
#include <core/loghelper.h>
|
||||||
#include <core/crypthelper.h>
|
#include <core/crypthelper.h>
|
||||||
@@ -30,13 +31,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#ifdef POKERTH_DEDICATED_SERVER
|
#define MAX_NUMBER_OF_FILES GetMaxNumberOfAvatarFiles()
|
||||||
#define MAX_NUMBER_OF_FILES 1024
|
#define MAX_AVATAR_CACHE_AGE GetMaxAvatarCacheAgeSec()
|
||||||
#define MAX_AVATAR_CACHE_AGE 2592000 // 1 Month
|
|
||||||
#else
|
|
||||||
#define MAX_NUMBER_OF_FILES 256
|
|
||||||
#define MAX_AVATAR_CACHE_AGE 86400
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PNG_HEADER "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a"
|
#define PNG_HEADER "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a"
|
||||||
#define PNG_HEADER_SIZE (sizeof(PNG_HEADER) - 1)
|
#define PNG_HEADER_SIZE (sizeof(PNG_HEADER) - 1)
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2007 by Lothar May *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifdef POKERTH_DEDICATED_SERVER
|
||||||
|
#error This file is only for the client.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <core/loghelper.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void
|
||||||
|
internal_log_err(const string &msg)
|
||||||
|
{
|
||||||
|
cout << msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
internal_log_msg(const std::string &msg)
|
||||||
|
{
|
||||||
|
cout << msg;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2007 by Lothar May *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef POKERTH_DEDICATED_SERVER
|
||||||
|
#error This file is only for the server.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <core/loghelper.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <iostream>
|
||||||
|
#else
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void
|
||||||
|
internal_log_err(const string &msg)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
cout << msg;
|
||||||
|
#else
|
||||||
|
syslog(LOG_ERR, "%s", msg.c_str());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
internal_log_msg(const std::string &msg)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
cout << msg;
|
||||||
|
#else
|
||||||
|
syslog(LOG_INFO, "%s", msg.c_str());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
+7
-16
@@ -21,17 +21,18 @@
|
|||||||
#ifndef _LOGHELPER_H_
|
#ifndef _LOGHELPER_H_
|
||||||
#define _LOGHELPER_H_
|
#define _LOGHELPER_H_
|
||||||
|
|
||||||
#ifndef _WIN32
|
#include <string>
|
||||||
#ifdef POKERTH_DEDICATED_SERVER
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <syslog.h>
|
|
||||||
#include <stdarg.h>
|
void internal_log_err(const std::string &msg);
|
||||||
|
void internal_log_msg(const std::string &msg);
|
||||||
|
|
||||||
#define LOG_ERROR(e) \
|
#define LOG_ERROR(e) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
std::ostringstream outStream; \
|
std::ostringstream outStream; \
|
||||||
outStream << e << std::endl; \
|
outStream << e << std::endl; \
|
||||||
syslog(LOG_ERR, "%s", outStream.str().c_str()); \
|
internal_log_err(outStream.str()); \
|
||||||
} \
|
} \
|
||||||
while(false)
|
while(false)
|
||||||
#define LOG_MSG(e) \
|
#define LOG_MSG(e) \
|
||||||
@@ -39,19 +40,9 @@
|
|||||||
{ \
|
{ \
|
||||||
std::ostringstream outStream; \
|
std::ostringstream outStream; \
|
||||||
outStream << e << std::endl; \
|
outStream << e << std::endl; \
|
||||||
syslog(LOG_INFO, "%s", outStream.str().c_str()); \
|
internal_log_msg(outStream.str()); \
|
||||||
} \
|
} \
|
||||||
while(false)
|
while(false)
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef LOG_ERROR
|
|
||||||
#include <iostream>
|
|
||||||
#define LOG_ERROR(e) \
|
|
||||||
std::cout << e << std::endl
|
|
||||||
#define LOG_MSG(e) \
|
|
||||||
std::cout << e << std::endl
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2007 by Lothar May *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifdef POKERTH_DEDICATED_SERVER
|
||||||
|
#error This file is only for the client.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <net/net_helper.h>
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
GetMaxNumberOfAvatarFiles()
|
||||||
|
{
|
||||||
|
return 256;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
GetMaxAvatarCacheAgeSec()
|
||||||
|
{
|
||||||
|
return 604800; // 1 Week
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2007 by Lothar May *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef POKERTH_DEDICATED_SERVER
|
||||||
|
#error This file is only for the server.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <net/net_helper.h>
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
GetMaxNumberOfAvatarFiles()
|
||||||
|
{
|
||||||
|
return 2048;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
GetMaxAvatarCacheAgeSec()
|
||||||
|
{
|
||||||
|
return 2592000; // 1 Month
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2007 by Lothar May *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
/* Retrieve internal configuration values. */
|
||||||
|
#ifndef _NET_HELPER_H_
|
||||||
|
#define _NET_HELPER_H_
|
||||||
|
|
||||||
|
unsigned GetMaxNumberOfAvatarFiles();
|
||||||
|
unsigned GetMaxAvatarCacheAgeSec();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -56,9 +56,7 @@ bool Session::init()
|
|||||||
{
|
{
|
||||||
myAvatarManager.reset(new AvatarManager);
|
myAvatarManager.reset(new AvatarManager);
|
||||||
bool retVal = myAvatarManager->Init(myConfig->readConfigString("AppDataDir"), myConfig->readConfigString("CacheDir"));
|
bool retVal = myAvatarManager->Init(myConfig->readConfigString("AppDataDir"), myConfig->readConfigString("CacheDir"));
|
||||||
#ifndef POKERTH_DEDICATED_SERVER
|
|
||||||
myAvatarManager->AddSingleAvatar(myConfig->readConfigString("MyAvatar"));
|
myAvatarManager->AddSingleAvatar(myConfig->readConfigString("MyAvatar"));
|
||||||
#endif
|
|
||||||
myAvatarManager->RemoveOldAvatarCacheEntries();
|
myAvatarManager->RemoveOldAvatarCacheEntries();
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user