mirror of
https://github.com/glest/glest-source.git
synced 2025-08-29 10:49:48 +02:00
- bugfix related to segfault when a network disconnect occurs while a thread is updating a slot
This commit is contained in:
@@ -260,6 +260,8 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||||||
bool &socketTriggered = event->socketTriggered;
|
bool &socketTriggered = event->socketTriggered;
|
||||||
bool checkForNewClients = true;
|
bool checkForNewClients = true;
|
||||||
|
|
||||||
|
// Safety check since we can experience a disconnect and the slot is NULL
|
||||||
|
if(slots[event->triggerId] == connectionSlot) {
|
||||||
if(connectionSlot != NULL &&
|
if(connectionSlot != NULL &&
|
||||||
(gameHasBeenInitiated == false || (connectionSlot->getSocket() != NULL && socketTriggered == true))) {
|
(gameHasBeenInitiated == false || (connectionSlot->getSocket() != NULL && socketTriggered == true))) {
|
||||||
if(connectionSlot->isConnected() == false || socketTriggered == true) {
|
if(connectionSlot->isConnected() == false || socketTriggered == true) {
|
||||||
@@ -271,6 +273,10 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||||||
else {
|
else {
|
||||||
if(gameHasBeenInitiated) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] getSocket() == NULL\n",__FILE__,__FUNCTION__);
|
if(gameHasBeenInitiated) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] getSocket() == NULL\n",__FILE__,__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(slots[event->triggerId] == connectionSlot) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
connectionSlot->update(checkForNewClients);
|
connectionSlot->update(checkForNewClients);
|
||||||
|
|
||||||
// This means no clients are trying to connect at the moment
|
// This means no clients are trying to connect at the moment
|
||||||
@@ -278,6 +284,18 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||||||
checkForNewClients = false;
|
checkForNewClients = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
event->connectionSlot = slots[event->triggerId];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
event->connectionSlot = slots[event->triggerId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
Reference in New Issue
Block a user