Insert last commit-id, message and date of last commit into sendLastVersion-message to ISMAS.

This commit is contained in:
Gerhard Hoffmann 2023-08-16 10:34:55 +02:00
parent ad93e536f0
commit 7631c05e22
2 changed files with 14 additions and 6 deletions

View File

@ -231,6 +231,8 @@ IsmasClient::sendRequestReceiveResponse(int port, QString const &request) {
tv.tv_sec = 60; /* 60 secs timeout for read and write */ tv.tv_sec = 60; /* 60 secs timeout for read and write */
tv.tv_usec = 0; tv.tv_usec = 0;
QString const selectStart = QDateTime::currentDateTime().toString(Qt::ISODateWithMs);
int const r = select(maxfdp1, &rset, NULL, NULL, &tv); int const r = select(maxfdp1, &rset, NULL, NULL, &tv);
if (r < 0) { // error if (r < 0) { // error
if (errno == EINTR) { if (errno == EINTR) {
@ -264,7 +266,8 @@ IsmasClient::sendRequestReceiveResponse(int port, QString const &request) {
if (n == 0) { if (n == 0) {
// The return value will be 0 when the peer has performed an orderly shutdown. // The return value will be 0 when the peer has performed an orderly shutdown.
printErrorMessage(port, clientIP, clientPort, printErrorMessage(port, clientIP, clientPort,
QString("PEER CLOSED CONNECTION (") + strerror(errno) + ")"); QString("PEER CLOSED CONNECTION (") + strerror(errno) + ") START AT" +
selectStart + " NOW " + QDateTime::currentDateTime().toString(Qt::ISODateWithMs));
::close(sockfd); ::close(sockfd);
return std::nullopt; return std::nullopt;
} else } else
@ -415,13 +418,11 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
static char buf[4096*2]; static char buf[4096*2];
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
QString const ts = QDateTime::currentDateTime().toString(Qt::ISODateWithMs);
QString sendVersionHash = "N/A";
// local data="#M=APISM#C=CMD_SENDVERSION#J= // local data="#M=APISM#C=CMD_SENDVERSION#J=
snprintf(buf, sizeof(buf)-1, snprintf(buf, sizeof(buf)-1,
"{" "{"
"\"VERSION_INFO\" : {" "\"VERSION_INFO\" : {"
"\"REASON\":\"%s\","
"\"CREATED\":\"%s\"," "\"CREATED\":\"%s\","
"\"HASH\":\"%s\"" "\"HASH\":\"%s\""
"}," "},"
@ -629,8 +630,9 @@ QString IsmasClient::updateOfPSASendVersion(PSAInstalled const &psa) {
"}" "}"
"}" "}"
"}", "}",
ts.toStdString().c_str(), psa.versionInfo.reason.toStdString().c_str(),
sendVersionHash.toStdString().c_str(), psa.versionInfo.created.toStdString().c_str(),
psa.versionInfo.lastCommit.toStdString().c_str(),
psa.tariff.version.toStdString().c_str(), psa.tariff.version.toStdString().c_str(),
psa.tariff.project.toStdString().c_str(), psa.tariff.project.toStdString().c_str(),

View File

@ -7,6 +7,12 @@
#include <optional> #include <optional>
struct PSAInstalled { struct PSAInstalled {
struct VersionInfo {
QString created;
QString reason;
QString lastCommit;
} versionInfo;
struct Tariff { struct Tariff {
QString name; QString name;
QString version; QString version;