- updated version number to beta15

- fixed bug affecting performance due to unconnected slots
This commit is contained in:
Mark Vejvoda
2010-06-28 03:17:50 +00:00
parent 94e07e442b
commit a7954abc02
5 changed files with 44 additions and 31 deletions

View File

@@ -26,7 +26,7 @@ using namespace Shared::Platform;
namespace Glest{ namespace Game{
const string mailString= "contact_game@glest.org";
const string glestVersionString= "v3.3.5-beta14";
const string glestVersionString= "v3.3.5-beta15";
string getCrashDumpFileName(){
return "glest" + glestVersionString + ".dmp";

View File

@@ -460,7 +460,6 @@ void Renderer::renderParticleManager(ResourceScope rs){
void Renderer::swapBuffers(){
//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();
}

View File

@@ -33,12 +33,14 @@ namespace Glest{ namespace Game{
// class ConnectionSlotThread
// =====================================================
ConnectionSlotThread::ConnectionSlotThread() : BaseThread() {
ConnectionSlotThread::ConnectionSlotThread(int slotIndex) : BaseThread() {
this->slotIndex = slotIndex;
this->slotInterface = NULL;
this->event = NULL;
}
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface) : BaseThread() {
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex) : BaseThread() {
this->slotIndex = slotIndex;
this->slotInterface = slotInterface;
this->event = NULL;
}
@@ -80,13 +82,13 @@ void ConnectionSlotThread::setTaskCompleted(ConnectionSlotEvent *event) {
}
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);
bool result = (this->event != NULL ? this->event->eventCompleted : true);
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;
}
@@ -158,7 +160,7 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
this->lastReceiveCommandListTime = 0;
this->socket = NULL;
this->slotThreadWorker = NULL;
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface);
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface,playerIndex);
this->slotThreadWorker->setUniqueID(__FILE__);
this->slotThreadWorker->start();
@@ -213,8 +215,10 @@ void ConnectionSlot::update(bool checkForNewClients) {
bool hasOpenSlots = (serverInterface->getOpenSlotCount() > 0);
if(serverInterface->getServerSocket()->hasDataToRead() == true) {
socket = serverInterface->getServerSocket()->accept();
if(socket != NULL) {
serverInterface->updateListen();
}
}
//send intro message when connected
if(socket != NULL) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] accepted new client connection, serverInterface->getOpenSlotCount() = %d\n",__FILE__,__FUNCTION__,serverInterface->getOpenSlotCount());
@@ -549,9 +553,14 @@ void ConnectionSlot::signalUpdate(ConnectionSlotEvent *event) {
bool ConnectionSlot::updateCompleted() {
assert(slotThreadWorker != NULL);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
bool waitingForThread = (slotThreadWorker->isSignalCompleted() == false &&
slotThreadWorker->getQuitStatus() == false &&
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);
}

View File

@@ -74,17 +74,18 @@ protected:
Semaphore semTaskSignalled;
Mutex triggerIdMutex;
ConnectionSlotEvent *event;
int slotIndex;
virtual void setQuitStatus(bool value);
virtual void setTaskCompleted(ConnectionSlotEvent *event);
public:
ConnectionSlotThread();
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface);
ConnectionSlotThread(int slotIndex);
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex);
virtual void execute();
void signalUpdate(ConnectionSlotEvent *event);
bool isSignalCompleted();
int getSlotIndex() const {return slotIndex; }
};
// =====================================================

View File

@@ -360,6 +360,7 @@ void ServerInterface::update() {
connectionSlot->clearThreadErrorList();
}
// Not done waiting for data yet
if(connectionSlot->updateCompleted() == false) {
threadsDone = false;
@@ -367,7 +368,10 @@ void ServerInterface::update() {
}
else {
// New lag check
bool clientLagExceeded = clientLagCheck(connectionSlot);
bool clientLagExceeded = false;
if(connectionSlot->isConnected() == true) {
clientLagExceeded = clientLagCheck(connectionSlot);
}
// If the client has exceeded lag and the server wants
// to pause while they catch up, re-trigger the
// client reader thread
@@ -382,7 +386,7 @@ void ServerInterface::update() {
}
}
}
//sleep(0);
sleep(0);
}
// Step #3 dispatch network commands to the pending list so that they are done in proper order