Changed: #1440 Handle more exit cases

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent 6e8a115eb3
commit cae3ef87cd

@ -414,7 +414,7 @@ void updatePathStatus(CDatabaseStatus* ds, CDatabaseStatusUpdater &updater, cons
void updateDirectoryStatus(CDatabaseStatus* ds, CDatabaseStatusUpdater &updater, const std::string &dir, bool recurse)
{
if (!g_IsMaster)
if (!g_IsExiting && !g_IsMaster)
{
nlerror("Not master, not allowed.");
}

@ -170,6 +170,9 @@ public:
g_IsMaster = false;
nldebug("Wait for tasks on the master");
while (m_TaskManager->getNumWaitingTasks() > 0)
nlSleep(10);
delete m_TaskManager;
m_TaskManager = NULL;
@ -523,6 +526,7 @@ public:
nlwarning("Slave disconnected before callback could be delivered");
CInfoFlags::getInstance()->removeFlag(PIPELINE_INFO_MASTER_UPDATE_DATABASE_FOR_SLAVE);
CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_SLAVE_CB_GONE);
Master->m_SlavesMutex.unlock();
delete this;
return;
}
@ -588,11 +592,18 @@ public:
}
if (ok)
{
if (g_IsExiting)
{
nlwarning("Cannot add task while exiting");
}
else
{
CUpdateDatabaseStatusByVectorTask *slaveTask = new CUpdateDatabaseStatusByVectorTask(this, sender, slave->Vector); // slave->Vector is wiped due to swap
m_TaskManager->addTask(slaveTask);
}
}
}
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////

@ -125,9 +125,15 @@ public:
// TODO?
// wait till build task has exited if still was running
// wait for other things to exist in case there are...
nldebug("Wait for tasks on the slave");
while (m_TaskManager->getNumWaitingTasks() > 0)
nlSleep(10);
delete m_TaskManager;
m_TaskManager = NULL;
if (m_AbortRequested)
finalizeAbort(); // hopefully this is fine
// temp sanity
nlassert(m_ActiveProject == NULL);
nlassert(m_ActiveProcess == NULL);

Loading…
Cancel
Save