diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index e5225b0b3..d86d5f1bf 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -563,12 +563,11 @@ void slsDetector::connectDataError() { setErrorMask((getErrorMask()) | (CANNOT_CONNECT_TO_RECEIVER)); } -int slsDetector::sendModule(sls_detector_module *myMod) { +int slsDetector::sendModule(sls_detector_module *myMod, sls::ClientSocket& client) { TLogLevel level = logDEBUG1; FILE_LOG(level) << "Sending Module"; int ts = 0; int n = 0; - auto client = sls::ClientSocket(false, thisDetector->hostname, thisDetector->controlPort); n = client.sendData(&(myMod->serialnumber), sizeof(myMod->serialnumber)); ts += n; FILE_LOG(level) << "Serial number sent. " << n << " bytes. serialno: " << myMod->serialnumber; @@ -613,8 +612,7 @@ int slsDetector::sendModule(sls_detector_module *myMod) { return ts; } -int slsDetector::receiveModule(sls_detector_module *myMod) { - auto client = sls::ClientSocket(false, thisDetector->hostname, thisDetector->controlPort); +int slsDetector::receiveModule(sls_detector_module *myMod, sls::ClientSocket& client) { int ts = 0; ts += client.receiveData(&(myMod->serialnumber), sizeof(myMod->serialnumber)); ts += client.receiveData(&(myMod->nchan), sizeof(myMod->nchan)); @@ -4012,7 +4010,7 @@ int slsDetector::setModule(sls_detector_module module, int tb) { if (thisDetector->onlineFlag == ONLINE_FLAG) { auto client = sls::ClientSocket(false, thisDetector->hostname, thisDetector->controlPort); client.sendData(&fnum, sizeof(fnum)); - sendModule(&module); + sendModule(&module, client); client.receiveData(&ret, sizeof(ret)); // handle ret @@ -4082,7 +4080,7 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule() { if (ret == FAIL) { setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE)); } else { - receiveModule(myMod); + receiveModule(myMod, client); } } if (ret == FORCE_UPDATE) { diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 14bb12ff1..043d34ac8 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -1711,14 +1711,14 @@ class slsDetector : public virtual slsDetectorDefs, public virtual errorDefs { * @param myMod module structure to send * @returns number of bytes sent to the detector */ - int sendModule(sls_detector_module *myMod); + int sendModule(sls_detector_module *myMod, sls::ClientSocket& client); /** * Receive a sls_detector_module structure over socket * @param myMod module structure to receive * @returns number of bytes received from the detector */ - int receiveModule(sls_detector_module *myMod); + int receiveModule(sls_detector_module *myMod, sls::ClientSocket& client); /** * Get MAC from the receiver using udpip and diff --git a/slsSupportLib/include/DataSocket.h b/slsSupportLib/include/DataSocket.h index 40559c5ea..fc88129d7 100644 --- a/slsSupportLib/include/DataSocket.h +++ b/slsSupportLib/include/DataSocket.h @@ -12,7 +12,7 @@ class DataSocket { virtual ~DataSocket(); DataSocket &operator=(DataSocket &&move) noexcept; void swap(DataSocket &other) noexcept; - DataSocket(DataSocket const &) = delete; + DataSocket(const DataSocket &) = delete; DataSocket &operator=(DataSocket const &) = delete; int getSocketId() const { return socketId_;