mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 16:02:50 +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{
|
||||
|
||||
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";
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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,7 +215,9 @@ void ConnectionSlot::update(bool checkForNewClients) {
|
||||
bool hasOpenSlots = (serverInterface->getOpenSlotCount() > 0);
|
||||
if(serverInterface->getServerSocket()->hasDataToRead() == true) {
|
||||
socket = serverInterface->getServerSocket()->accept();
|
||||
serverInterface->updateListen();
|
||||
if(socket != NULL) {
|
||||
serverInterface->updateListen();
|
||||
}
|
||||
}
|
||||
//send intro message when connected
|
||||
if(socket != NULL) {
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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; }
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
|
@@ -360,29 +360,33 @@ void ServerInterface::update() {
|
||||
connectionSlot->clearThreadErrorList();
|
||||
}
|
||||
|
||||
|
||||
// Not done waiting for data yet
|
||||
if(connectionSlot->updateCompleted() == false) {
|
||||
threadsDone = false;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// New lag check
|
||||
bool 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
|
||||
if(clientLagExceeded == true && pauseGameForLaggedClients == true) {
|
||||
bool socketTriggered = (connectionSlot != NULL && connectionSlot->getSocket() != NULL ? socketTriggeredList[connectionSlot->getSocket()->getSocketId()] : false);
|
||||
ConnectionSlotEvent &event = eventList[i];
|
||||
signalClientReceiveCommands(connectionSlot,i,socketTriggered,event);
|
||||
}
|
||||
else {
|
||||
slotsCompleted[i] = true;
|
||||
}
|
||||
}
|
||||
if(connectionSlot->updateCompleted() == false) {
|
||||
threadsDone = false;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// New lag check
|
||||
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
|
||||
if(clientLagExceeded == true && pauseGameForLaggedClients == true) {
|
||||
bool socketTriggered = (connectionSlot != NULL && connectionSlot->getSocket() != NULL ? socketTriggeredList[connectionSlot->getSocket()->getSocketId()] : false);
|
||||
ConnectionSlotEvent &event = eventList[i];
|
||||
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
|
||||
|
Reference in New Issue
Block a user