- bugfix related to segfault when a network disconnect occurs while a thread is updating a slot
This commit is contained in:
parent
bc7ba297fd
commit
f5f406dfb3
|
@ -260,25 +260,43 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
||||||
bool &socketTriggered = event->socketTriggered;
|
bool &socketTriggered = event->socketTriggered;
|
||||||
bool checkForNewClients = true;
|
bool checkForNewClients = true;
|
||||||
|
|
||||||
if(connectionSlot != NULL &&
|
// Safety check since we can experience a disconnect and the slot is NULL
|
||||||
(gameHasBeenInitiated == false || (connectionSlot->getSocket() != NULL && socketTriggered == true))) {
|
if(slots[event->triggerId] == connectionSlot) {
|
||||||
if(connectionSlot->isConnected() == false || socketTriggered == true) {
|
if(connectionSlot != NULL &&
|
||||||
if(gameHasBeenInitiated) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] socketTriggeredList[i] = %i\n",__FILE__,__FUNCTION__,(socketTriggered ? 1 : 0));
|
(gameHasBeenInitiated == false || (connectionSlot->getSocket() != NULL && socketTriggered == true))) {
|
||||||
|
if(connectionSlot->isConnected() == false || socketTriggered == true) {
|
||||||
|
if(gameHasBeenInitiated) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] socketTriggeredList[i] = %i\n",__FILE__,__FUNCTION__,(socketTriggered ? 1 : 0));
|
||||||
|
|
||||||
if(connectionSlot->isConnected()) {
|
if(connectionSlot->isConnected()) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] about to call connectionSlot->update() for socketId = %d\n",__FILE__,__FUNCTION__,__LINE__,connectionSlot->getSocket()->getSocketId());
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] about to call connectionSlot->update() for socketId = %d\n",__FILE__,__FUNCTION__,__LINE__,connectionSlot->getSocket()->getSocketId());
|
||||||
}
|
}
|
||||||
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__);
|
||||||
}
|
}
|
||||||
connectionSlot->update(checkForNewClients);
|
|
||||||
|
|
||||||
// This means no clients are trying to connect at the moment
|
if(slots[event->triggerId] == connectionSlot) {
|
||||||
if(connectionSlot != NULL && connectionSlot->getSocket() == NULL) {
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
checkForNewClients = false;
|
|
||||||
|
connectionSlot->update(checkForNewClients);
|
||||||
|
|
||||||
|
// This means no clients are trying to connect at the moment
|
||||||
|
if(connectionSlot != NULL && connectionSlot->getSocket() == NULL) {
|
||||||
|
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__);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user