diff --git a/MAC/APL/Appl_Controller/ApplController.cc b/MAC/APL/Appl_Controller/ApplController.cc index 1d3f2036f6ce57f92d6c0f3af9e3c3272abbe122..4807793334719e6537ad966efd9ef3ce71a716ec 100644 --- a/MAC/APL/Appl_Controller/ApplController.cc +++ b/MAC/APL/Appl_Controller/ApplController.cc @@ -63,7 +63,8 @@ ApplController::ApplController(const string& configID) : itsIsRunning (false), itsStateEngine (new StateEngine), itsCurState (StateNone), - itsCurACMsg (0) + itsCurACMsg (0), + itsNrOfProcs (0) { LOG_TRACE_OBJ ("ApplController constructor"); @@ -398,8 +399,8 @@ void ApplController::createParSubsets() fileName, nrProcs)); writeParSubset(basePS, procName, fileName); - // CN processes do not connect to the ApplController. - itsNrOfProcs -= nrProcs ? nrProcs : 1; + // CN processes do now connect to the ApplController. + //itsNrOfProcs -= nrProcs ? nrProcs : 1; } } // for processes } diff --git a/RTCP/IONProc/src/PLCClient.cc b/RTCP/IONProc/src/PLCClient.cc index 8f9ce121379a8062026c801f497c65928a34a677..4060f43180b95997bdff6013c6b7942b63c877a4 100644 --- a/RTCP/IONProc/src/PLCClient.cc +++ b/RTCP/IONProc/src/PLCClient.cc @@ -174,7 +174,7 @@ template<> void FakeBlob::read<string>( Stream &s, string &str ) const { read( s, length ); - cstr = new char[length]; + cstr = new char[length+1]; // make sure cstr won't leak if s.read throws struct D { @@ -184,6 +184,7 @@ template<> void FakeBlob::read<string>( Stream &s, string &str ) const { (void)onDestruct; s.read( cstr, length ); + cstr[length] = 0; str = cstr; } @@ -266,7 +267,7 @@ PLCClient::PLCClient( Stream &s, PLCRunnable &job, const std::string &procID, un itsStartTime( time(0L) ), itsDefineCalled( false ), itsDone( false ), - itsLogPrefix( str(format("[PLC] [obs %u] ") % observationID) ), + itsLogPrefix( str(format("[obs %u] [PLC] ") % observationID) ), itsThread( 0 ) { itsThread = new InterruptibleThread( this, &PLCClient::mainLoop, "[PLC] ", 65535 ); @@ -381,7 +382,14 @@ void PLCClient::mainLoop() { bool resultExpected = true; bool supported = true; - recvCmd( cmd, options ); + try { + recvCmd( cmd, options ); + } catch (SystemCallException &ex) { + if (itsDone) + LOG_INFO_STR( itsLogPrefix << "Lost connection to ApplController, but am quitting."); + else + throw; + } switch (cmd) { case PCCmdInfo: