From 0ddc6376cdfb6d6e5d4829e37cd450da5d6e333e Mon Sep 17 00:00:00 2001
From: Ruud Overeem <overeem@astron.nl>
Date: Thu, 10 May 2007 10:54:46 +0000
Subject: [PATCH] BugID:  826 During startup the Application did not wait for
 all the processes that are starting, it entered the define phase too early.

---
 LCS/ACC/ACCbin/include/ACCbin/ApplController.h |  2 ++
 LCS/ACC/ACCbin/src/ApplController.cc           | 10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/LCS/ACC/ACCbin/include/ACCbin/ApplController.h b/LCS/ACC/ACCbin/include/ACCbin/ApplController.h
index bea8a1357fa..6ebcc954389 100644
--- a/LCS/ACC/ACCbin/include/ACCbin/ApplController.h
+++ b/LCS/ACC/ACCbin/include/ACCbin/ApplController.h
@@ -109,6 +109,8 @@ private:
 	DH_ApplControl*		itsCurACMsg;		// Command under handling
 
 	ProcRuler			itsProcRuler;		// Starts/stops all AP's
+
+	uint16				itsNrOfProcs;		// Nr of processes to manage.
 };
 
 // @} addgroup
diff --git a/LCS/ACC/ACCbin/src/ApplController.cc b/LCS/ACC/ACCbin/src/ApplController.cc
index 94162ebb0a8..0553c2a9ead 100644
--- a/LCS/ACC/ACCbin/src/ApplController.cc
+++ b/LCS/ACC/ACCbin/src/ApplController.cc
@@ -255,6 +255,7 @@ void ApplController::createParSubsets()
 		// nrProcs  := x | 0
 		string procName = procList[procIdx];
 		int32  nrProcs  = indexValue(procName, "()");
+		itsNrOfProcs += nrProcs;
 		rtrim(procName, "()0123456789");
 		string procPrefix = applName +"." + procName;
         
@@ -692,9 +693,16 @@ void ApplController::checkAckCompletion()
 
 	if (itsCurState == StateStartupAppl) {
 //		if (itsAPAPool->onlineCount() == itsProcRuler.size()) {
-		if (itsAPAPool->onlineCount() == itsAPAPool->processCount()) {
+//		if (itsAPAPool->onlineCount() == itsAPAPool->processCount()) {
+		if (itsAPAPool->onlineCount() == itsNrOfProcs) {
 			itsStateEngine->ready();
 		}
+		else {
+			LOG_TRACE_STAT_STR("Still waiting for: " << itsNrOfProcs << "-"
+					<< itsAPAPool->onlineCount() << "=" << itsNrOfProcs-itsAPAPool->onlineCount() 
+					<< " connections");
+		}
+		return;
 	}
 
 	if (itsAPAPool->allAcksReceived()) {
-- 
GitLab