- 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,6 +260,8 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||
bool &socketTriggered = event->socketTriggered;
|
||||
bool checkForNewClients = true;
|
||||
|
||||
// Safety check since we can experience a disconnect and the slot is NULL
|
||||
if(slots[event->triggerId] == connectionSlot) {
|
||||
if(connectionSlot != NULL &&
|
||||
(gameHasBeenInitiated == false || (connectionSlot->getSocket() != NULL && socketTriggered == true))) {
|
||||
if(connectionSlot->isConnected() == false || socketTriggered == true) {
|
||||
|
@ -271,6 +273,10 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||
else {
|
||||
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);
|
||||
|
||||
// This means no clients are trying to connect at the moment
|
||||
|
@ -278,6 +284,18 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||
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__);
|
||||
|
|
Loading…
Reference in New Issue
Block a user