From 147194e8af39009a201b1bfb6b9d75fcdee223bd Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Fri, 3 Aug 2018 14:54:32 +0200 Subject: [PATCH] slsDetector: connect stop socket in checkonline so that it does not stick to its initialized default file descriptor zero (which gets closed upon socket deletion) --- manual/manual-api/Makefile | 2 +- .../slsDetector/slsDetector.cpp | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/manual/manual-api/Makefile b/manual/manual-api/Makefile index 6c424e5f6..42dcf7004 100644 --- a/manual/manual-api/Makefile +++ b/manual/manual-api/Makefile @@ -1,5 +1,5 @@ PKGDIR = ../.. -LIBDIR = $(PKGDIR)/bin +LIBDIR = $(PKGDIR)/build/bin INCLUDES = -I . -I$(PKGDIR)/slsReceiverSoftware/include -I$(PKGDIR)/slsDetectorSoftware/slsDetectorAnalysis -I$(LIBDIR) -I$(PKGDIR)/slsDetectorSoftware/slsDetector SRC_DET = mainClient.cpp SRC_REC = mainReceiver.cpp diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 9656db125..a0506e93f 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -1756,6 +1756,26 @@ string slsDetector::checkOnline() { disconnectControl(); #ifdef VERBOSE std::cout<< "online!" << std::endl; +#endif + } + } + //still cannot connect to socket, stopSocket=0 + if(stopSocket){ + if (connectStop() == FAIL) { + stopSocket->SetTimeOut(5); + thisDetector->onlineFlag=OFFLINE_FLAG; + delete stopSocket; + stopSocket=NULL; + retval = string(thisDetector->hostname); +#ifdef VERBOSE + std::cout<< "stop offline!" << std::endl; +#endif + } else { + thisDetector->onlineFlag=ONLINE_FLAG; + stopSocket->SetTimeOut(100); + disconnectStop(); +#ifdef VERBOSE + std::cout<< "stop online!" << std::endl; #endif } }