checkonline, checkrecieveronline, retval has offline hostnames, online flag should be set no matter what the outcome

This commit is contained in:
maliakal_d 2019-03-14 13:18:42 +01:00
parent 5235a87e93
commit be33102164

View File

@ -748,10 +748,10 @@ std::string slsDetector::checkOnline() {
//Need both control and stop socket to work! //Need both control and stop socket to work!
auto client = sls::ClientSocket(false, detector_shm()->hostname, detector_shm()->controlPort); auto client = sls::ClientSocket(false, detector_shm()->hostname, detector_shm()->controlPort);
auto stop = sls::ClientSocket(false, detector_shm()->hostname, detector_shm()->stopPort); auto stop = sls::ClientSocket(false, detector_shm()->hostname, detector_shm()->stopPort);
retval = detector_shm()->hostname; detector_shm()->onlineFlag = ONLINE_FLAG;
} catch (...) { } catch (...) {
//try catch should not be used for control but we should also not call this function
detector_shm()->onlineFlag = OFFLINE_FLAG; detector_shm()->onlineFlag = OFFLINE_FLAG;
retval = detector_shm()->hostname;
} }
return retval; return retval;
} }
@ -4051,8 +4051,10 @@ std::string slsDetector::checkReceiverOnline() {
std::string retval; std::string retval;
try { try {
auto receiver = sls::ClientSocket(true, detector_shm()->receiver_hostname, detector_shm()->receiverTCPPort); auto receiver = sls::ClientSocket(true, detector_shm()->receiver_hostname, detector_shm()->receiverTCPPort);
retval = detector_shm()->receiver_hostname; detector_shm()->receiverOnlineFlag = ONLINE_FLAG;
} catch (...) { } catch (...) {
detector_shm()->receiverOnlineFlag = OFFLINE_FLAG;
retval = detector_shm()->receiver_hostname;
} }
return retval; return retval;
} }