From dbe4e9792105343e962b7b637e1ec6979f3cdf68 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Fri, 28 Aug 2015 09:00:13 +0000 Subject: [PATCH] Task #6883: Deal with clients disconnecting during their clock set request --- .../StationCU/src/ClockControl/ClockControl.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/MAC/APL/StationCU/src/ClockControl/ClockControl.cc b/MAC/APL/StationCU/src/ClockControl/ClockControl.cc index 5d4547dd757..2aa9b7a38d4 100644 --- a/MAC/APL/StationCU/src/ClockControl/ClockControl.cc +++ b/MAC/APL/StationCU/src/ClockControl/ClockControl.cc @@ -713,9 +713,14 @@ GCFEvent::TResult ClockControl::setClock_state(GCFEvent& event, } case RSP_UPDCLOCK: { - CLKCTRLSetClockAckEvent response; - response.status = CLKCTRL_NO_ERR; - itsLastCommandClient->send(response); + if (itsLastCommandClient) { + CLKCTRLSetClockAckEvent response; + response.status = CLKCTRL_NO_ERR; + itsLastCommandClient->send(response); + LOG_DEBUG("Informed client of clock update"); + } else { + LOG_WARN("Client disconnected, so could not ack clock update"); + } LOG_INFO_STR ("Received clock update, going to operational state"); TRAN(ClockControl::active_state); // go to next state. return (GCFEvent::NEXT_STATE); @@ -1213,6 +1218,10 @@ void ClockControl::_disconnectedHandler(GCFPortInterface& port) TRAN (ClockControl::connect2RSP_state); } else { + if (&port == itsLastCommandClient) { + itsLastCommandClient = 0; + } + itsClientList.remove(&port); } } -- GitLab