- a load of bugfixes including:

- proper handling of invalid client connects, after 6 bad attempts in a 60 second period of time the IP address is blocked from the current game
  - Added check for invalid particles for tileset objects
  - Made messagebox wider in game mod menu
  - Fixed numerous threading issues discovered while testing on my 8 core CPU
  - a Little bit of rendering cleanup
This commit is contained in:
Mark Vejvoda
2011-11-23 08:00:09 +00:00
parent 0dacf7b439
commit 3cdf50c399
29 changed files with 962 additions and 687 deletions

View File

@@ -50,6 +50,8 @@ protected:
virtual void setQuitStatus(bool value);
void deleteSelfIfRequired();
void *genericData;
public:
BaseThread();
virtual ~BaseThread();
@@ -83,6 +85,11 @@ public:
Mutex * getMutexThreadOwnerValid();
Mutex * getMutexThreadObjectAccessor() { return &mutexThreadObjectAccessor; }
template <typename T>
T * getGenericData() { return genericData; }
template <typename T>
void setGenericData(T *value) { genericData = value; }
};
class RunningStatusSafeWrapper {

View File

@@ -41,6 +41,11 @@ using Shared::Util::Checksum;
namespace Shared { namespace PlatformCommon {
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define CODE_AT_LINE __FILE__ ":" TOSTRING(__LINE__)
#define CODE_AT_LINE_X(x) __FILE__ ":" TOSTRING(__LINE__) ":" TOSTRING(x)
static const int IGNORE_CMD_RESULT_VALUE = -999999;
// keycode constants (unfortunately designed after DirectInput and therefore not

View File

@@ -69,6 +69,9 @@ public:
class SimpleTaskCallbackInterface {
public:
virtual void simpleTask(BaseThread *callingThread) = 0;
virtual void setupTask(BaseThread *callingThread) {}
virtual void shutdownTask(BaseThread *callingThread) {}
};
class SimpleTaskThread : public BaseThread
@@ -87,11 +90,12 @@ protected:
time_t lastExecuteTimestamp;
public:
SimpleTaskThread();
SimpleTaskThread(SimpleTaskCallbackInterface *simpleTaskInterface,
unsigned int executionCount=0,
unsigned int millisecsBetweenExecutions=0,
bool needTaskSignal = false);
virtual ~SimpleTaskThread();
virtual void execute();
virtual bool canShutdown(bool deleteSelfIfShutdownDelayed=false);

View File

@@ -204,12 +204,17 @@ protected:
class BroadCastSocketThread : public BaseThread
{
private:
Mutex mutexPauseBroadcast;
bool pauseBroadcast;
public:
BroadCastSocketThread();
virtual ~BroadCastSocketThread();
virtual void execute();
virtual bool canShutdown(bool deleteSelfIfShutdownDelayed=false);
bool getPauseBroadcast();
void setPauseBroadcast(bool value);
};
// =====================================================
@@ -229,6 +234,7 @@ protected:
virtual void UPNPInitStatus(bool result);
BroadCastSocketThread *broadCastThread;
void startBroadCastThread();
void resumeBroadcast();
bool isBroadCastThreadRunning();
vector<string> blockIPList;
@@ -239,6 +245,8 @@ public:
void listen(int connectionQueueSize= SOMAXCONN);
Socket *accept();
void stopBroadCastThread();
void pauseBroadcast();
void addIPAddressToBlockedList(string value);
bool isIPAddressBlocked(string value) const;
@@ -275,6 +283,7 @@ public:
static bool isUPNP;
static bool enabledUPNP;
static Mutex mutexUPNP;
static int upnp_init(void *param);

View File

@@ -77,11 +77,14 @@ private:
class Mutex {
private:
SDL_mutex* mutex;
int refCount;
string ownerId;
string deleteownerId;
SDL_mutex* mutexAccessor;
public:
Mutex(string ownerId="");
~Mutex();