Store the disconnect reason in the device info
This commit is contained in:
parent
3696869a99
commit
92b305aa89
|
@ -13,7 +13,7 @@ set(META_VERSION_MAJOR 1)
|
|||
set(META_VERSION_MINOR 4)
|
||||
set(META_VERSION_PATCH 6)
|
||||
set(META_RELEASE_DATE "2023-08-09")
|
||||
set(META_SOVERSION 8)
|
||||
set(META_SOVERSION 9)
|
||||
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)
|
||||
|
||||
project(${META_PROJECT_NAME})
|
||||
|
|
|
@ -2001,12 +2001,15 @@ void SyncthingConnection::readDeviceEvent(SyncthingEventId eventId, DateTime eve
|
|||
}
|
||||
|
||||
// distinguish specific events
|
||||
SyncthingDevStatus status = devInfo->status;
|
||||
bool paused = devInfo->paused;
|
||||
auto status = devInfo->status;
|
||||
auto paused = devInfo->paused;
|
||||
auto disconnectReason = devInfo->disconnectReason;
|
||||
if (eventType == QLatin1String("DeviceConnected")) {
|
||||
status = devInfo->computeConnectedStateAccordingToCompletion();
|
||||
disconnectReason.clear();
|
||||
} else if (eventType == QLatin1String("DeviceDisconnected")) {
|
||||
status = SyncthingDevStatus::Disconnected;
|
||||
disconnectReason = eventData.value(QLatin1String("error")).toString();
|
||||
} else if (eventType == QLatin1String("DevicePaused")) {
|
||||
paused = true;
|
||||
} else if (eventType == QLatin1String("DeviceRejected")) {
|
||||
|
@ -2020,11 +2023,12 @@ void SyncthingConnection::readDeviceEvent(SyncthingEventId eventId, DateTime eve
|
|||
}
|
||||
|
||||
// assign new status
|
||||
if (devInfo->status != status || devInfo->paused != paused) {
|
||||
if (devInfo->status != status || devInfo->paused != paused || devInfo->disconnectReason != disconnectReason) {
|
||||
// don't mess with the status of the own device
|
||||
if (devInfo->status != SyncthingDevStatus::OwnDevice) {
|
||||
devInfo->status = status;
|
||||
devInfo->paused = paused;
|
||||
devInfo->disconnectReason = disconnectReason;
|
||||
}
|
||||
emit devStatusChanged(*devInfo, index);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ struct LIB_SYNCTHING_CONNECTOR_EXPORT SyncthingDev {
|
|||
QString connectionAddress;
|
||||
QString connectionType;
|
||||
QString clientVersion;
|
||||
QString disconnectReason;
|
||||
CppUtilities::DateTime lastSeen;
|
||||
std::unordered_map<QString, SyncthingCompletion> completionByDir;
|
||||
SyncthingCompletion overallCompletion;
|
||||
|
|
Loading…
Reference in New Issue