mirror of
https://github.com/glest/glest-source.git
synced 2025-08-23 00:12:49 +02:00
- updated version number to beta15
- fixed bug affecting performance due to unconnected slots
This commit is contained in:
@@ -26,7 +26,7 @@ using namespace Shared::Platform;
|
|||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
const string mailString= "contact_game@glest.org";
|
const string mailString= "contact_game@glest.org";
|
||||||
const string glestVersionString= "v3.3.5-beta14";
|
const string glestVersionString= "v3.3.5-beta15";
|
||||||
|
|
||||||
string getCrashDumpFileName(){
|
string getCrashDumpFileName(){
|
||||||
return "glest" + glestVersionString + ".dmp";
|
return "glest" + glestVersionString + ".dmp";
|
||||||
|
@@ -460,7 +460,6 @@ void Renderer::renderParticleManager(ResourceScope rs){
|
|||||||
void Renderer::swapBuffers(){
|
void Renderer::swapBuffers(){
|
||||||
|
|
||||||
//glFlush(); // should not be required - http://www.opengl.org/wiki/Common_Mistakes
|
//glFlush(); // should not be required - http://www.opengl.org/wiki/Common_Mistakes
|
||||||
glFlush(); // <--- this might actually be needed for better Render performance???
|
|
||||||
|
|
||||||
GraphicsInterface::getInstance().getCurrentContext()->swapBuffers();
|
GraphicsInterface::getInstance().getCurrentContext()->swapBuffers();
|
||||||
}
|
}
|
||||||
|
@@ -33,12 +33,14 @@ namespace Glest{ namespace Game{
|
|||||||
// class ConnectionSlotThread
|
// class ConnectionSlotThread
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
ConnectionSlotThread::ConnectionSlotThread() : BaseThread() {
|
ConnectionSlotThread::ConnectionSlotThread(int slotIndex) : BaseThread() {
|
||||||
|
this->slotIndex = slotIndex;
|
||||||
this->slotInterface = NULL;
|
this->slotInterface = NULL;
|
||||||
this->event = NULL;
|
this->event = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface) : BaseThread() {
|
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex) : BaseThread() {
|
||||||
|
this->slotIndex = slotIndex;
|
||||||
this->slotInterface = slotInterface;
|
this->slotInterface = slotInterface;
|
||||||
this->event = NULL;
|
this->event = NULL;
|
||||||
}
|
}
|
||||||
@@ -80,13 +82,13 @@ void ConnectionSlotThread::setTaskCompleted(ConnectionSlotEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectionSlotThread::isSignalCompleted() {
|
bool ConnectionSlotThread::isSignalCompleted() {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex);
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
MutexSafeWrapper safeMutex(&triggerIdMutex);
|
||||||
bool result = (this->event != NULL ? this->event->eventCompleted : true);
|
bool result = (this->event != NULL ? this->event->eventCompleted : true);
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
if(result == false) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] slotIndex = %d, result = %d\n",__FILE__,__FUNCTION__,__LINE__,slotIndex,result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -158,7 +160,7 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
|
|||||||
this->lastReceiveCommandListTime = 0;
|
this->lastReceiveCommandListTime = 0;
|
||||||
this->socket = NULL;
|
this->socket = NULL;
|
||||||
this->slotThreadWorker = NULL;
|
this->slotThreadWorker = NULL;
|
||||||
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface);
|
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface,playerIndex);
|
||||||
this->slotThreadWorker->setUniqueID(__FILE__);
|
this->slotThreadWorker->setUniqueID(__FILE__);
|
||||||
this->slotThreadWorker->start();
|
this->slotThreadWorker->start();
|
||||||
|
|
||||||
@@ -213,7 +215,9 @@ void ConnectionSlot::update(bool checkForNewClients) {
|
|||||||
bool hasOpenSlots = (serverInterface->getOpenSlotCount() > 0);
|
bool hasOpenSlots = (serverInterface->getOpenSlotCount() > 0);
|
||||||
if(serverInterface->getServerSocket()->hasDataToRead() == true) {
|
if(serverInterface->getServerSocket()->hasDataToRead() == true) {
|
||||||
socket = serverInterface->getServerSocket()->accept();
|
socket = serverInterface->getServerSocket()->accept();
|
||||||
serverInterface->updateListen();
|
if(socket != NULL) {
|
||||||
|
serverInterface->updateListen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//send intro message when connected
|
//send intro message when connected
|
||||||
if(socket != NULL) {
|
if(socket != NULL) {
|
||||||
@@ -549,9 +553,14 @@ void ConnectionSlot::signalUpdate(ConnectionSlotEvent *event) {
|
|||||||
bool ConnectionSlot::updateCompleted() {
|
bool ConnectionSlot::updateCompleted() {
|
||||||
assert(slotThreadWorker != NULL);
|
assert(slotThreadWorker != NULL);
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
||||||
|
|
||||||
bool waitingForThread = (slotThreadWorker->isSignalCompleted() == false &&
|
bool waitingForThread = (slotThreadWorker->isSignalCompleted() == false &&
|
||||||
slotThreadWorker->getQuitStatus() == false &&
|
slotThreadWorker->getQuitStatus() == false &&
|
||||||
slotThreadWorker->getRunningStatus() == true);
|
slotThreadWorker->getRunningStatus() == true);
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d, waitingForThread = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex,waitingForThread);
|
||||||
|
|
||||||
return (waitingForThread == false);
|
return (waitingForThread == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,17 +74,18 @@ protected:
|
|||||||
Semaphore semTaskSignalled;
|
Semaphore semTaskSignalled;
|
||||||
Mutex triggerIdMutex;
|
Mutex triggerIdMutex;
|
||||||
ConnectionSlotEvent *event;
|
ConnectionSlotEvent *event;
|
||||||
|
int slotIndex;
|
||||||
|
|
||||||
virtual void setQuitStatus(bool value);
|
virtual void setQuitStatus(bool value);
|
||||||
virtual void setTaskCompleted(ConnectionSlotEvent *event);
|
virtual void setTaskCompleted(ConnectionSlotEvent *event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConnectionSlotThread();
|
ConnectionSlotThread(int slotIndex);
|
||||||
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface);
|
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex);
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
void signalUpdate(ConnectionSlotEvent *event);
|
void signalUpdate(ConnectionSlotEvent *event);
|
||||||
bool isSignalCompleted();
|
bool isSignalCompleted();
|
||||||
|
int getSlotIndex() const {return slotIndex; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
@@ -360,29 +360,33 @@ void ServerInterface::update() {
|
|||||||
connectionSlot->clearThreadErrorList();
|
connectionSlot->clearThreadErrorList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Not done waiting for data yet
|
// Not done waiting for data yet
|
||||||
if(connectionSlot->updateCompleted() == false) {
|
if(connectionSlot->updateCompleted() == false) {
|
||||||
threadsDone = false;
|
threadsDone = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// New lag check
|
// New lag check
|
||||||
bool clientLagExceeded = clientLagCheck(connectionSlot);
|
bool clientLagExceeded = false;
|
||||||
// If the client has exceeded lag and the server wants
|
if(connectionSlot->isConnected() == true) {
|
||||||
// to pause while they catch up, re-trigger the
|
clientLagExceeded = clientLagCheck(connectionSlot);
|
||||||
// client reader thread
|
}
|
||||||
if(clientLagExceeded == true && pauseGameForLaggedClients == true) {
|
// If the client has exceeded lag and the server wants
|
||||||
bool socketTriggered = (connectionSlot != NULL && connectionSlot->getSocket() != NULL ? socketTriggeredList[connectionSlot->getSocket()->getSocketId()] : false);
|
// to pause while they catch up, re-trigger the
|
||||||
ConnectionSlotEvent &event = eventList[i];
|
// client reader thread
|
||||||
signalClientReceiveCommands(connectionSlot,i,socketTriggered,event);
|
if(clientLagExceeded == true && pauseGameForLaggedClients == true) {
|
||||||
}
|
bool socketTriggered = (connectionSlot != NULL && connectionSlot->getSocket() != NULL ? socketTriggeredList[connectionSlot->getSocket()->getSocketId()] : false);
|
||||||
else {
|
ConnectionSlotEvent &event = eventList[i];
|
||||||
slotsCompleted[i] = true;
|
signalClientReceiveCommands(connectionSlot,i,socketTriggered,event);
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
|
slotsCompleted[i] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//sleep(0);
|
sleep(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step #3 dispatch network commands to the pending list so that they are done in proper order
|
// Step #3 dispatch network commands to the pending list so that they are done in proper order
|
||||||
|
Reference in New Issue
Block a user