7.0.1 fix det server version (#702)

* check server version before initial checks, catch old server version exception, get old server version as 64 bit and print it along with exception
This commit is contained in:
Dhanya Thattil 2023-03-23 15:37:01 +01:00 committed by GitHub
parent 2ef021041c
commit 87d6e16090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 5 deletions

View File

@ -20,7 +20,7 @@ This document describes the differences between v7.0.1 and v7.0.0
================= =================
Receiver: Receiver
-------- --------
@ -35,6 +35,22 @@ This document describes the differences between v7.0.1 and v7.0.0
Client
------
* Detector Server Version from previous Releases
Hostname command would hang with 7.0.0 client if the detector server
was from a previous release (eg. 6.1.2). In this case, the user cannot
get the detector server version.
Fixed that the hostname command will throw an exception about
incompatible server with its version in the message. Now, the user can
get the version number without having to telnet or ssh to the detector.
With this info, one can then update to matching client for that server
and start the detector updation process.
2 On-board Detector Server Compatibility 2 On-board Detector Server Compatibility
========================================== ==========================================

View File

@ -73,8 +73,8 @@ void Module::setHostname(const std::string &hostname,
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.close(); client.close();
try { try {
initialDetectorServerChecks();
checkDetectorVersionCompatibility(); checkDetectorVersionCompatibility();
initialDetectorServerChecks();
LOG(logINFO) << "Module Version Compatibility - Success"; LOG(logINFO) << "Module Version Compatibility - Success";
} catch (const RuntimeError &e) { } catch (const RuntimeError &e) {
if (!initialChecks) { if (!initialChecks) {
@ -93,9 +93,28 @@ int64_t Module::getFirmwareVersion() const {
} }
std::string Module::getControlServerLongVersion() const { std::string Module::getControlServerLongVersion() const {
char retval[MAX_STR_LENGTH]{}; try {
sendToDetector(F_GET_SERVER_VERSION, nullptr, retval); char retval[MAX_STR_LENGTH]{};
return retval; sendToDetector(F_GET_SERVER_VERSION, nullptr, retval);
return retval;
}
// throw with old server version (sends 8 bytes)
catch (RuntimeError &e) {
std::string emsg = std::string(e.what());
if (emsg.find(F_GET_SERVER_VERSION) && emsg.find("8 bytes")) {
throwDeprecatedServerVersion();
}
throw;
}
}
void Module::throwDeprecatedServerVersion() const {
uint64_t res = sendToDetectorStop<int64_t>(F_GET_SERVER_VERSION);
std::cout << std::endl;
std::ostringstream os;
os << "Detector Server (Control) version (0x" << std::hex << res
<< ") is incompatible with this client. Please update detector server!";
throw RuntimeError(os.str());
} }
std::string Module::getStopServerLongVersion() const { std::string Module::getStopServerLongVersion() const {

View File

@ -92,6 +92,7 @@ class Module : public virtual slsDetectorDefs {
int64_t getFirmwareVersion() const; int64_t getFirmwareVersion() const;
std::string getControlServerLongVersion() const; std::string getControlServerLongVersion() const;
std::string getStopServerLongVersion() const; std::string getStopServerLongVersion() const;
void throwDeprecatedServerVersion() const;
std::string getDetectorServerVersion() const; std::string getDetectorServerVersion() const;
std::string getHardwareVersion() const; std::string getHardwareVersion() const;
std::string getKernelVersion() const; std::string getKernelVersion() const;