Skip to content

Commit

Permalink
Improve support for traffic receivers that request a password, but do…
Browse files Browse the repository at this point in the history
… not need it
  • Loading branch information
Stefan Kebekus committed Sep 14, 2021
1 parent 24ed82e commit baee949
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ option(BUILD_DOC "Build developer documentation" OFF)
# Project data
#

project(enroute VERSION 2.11.1)
project(enroute VERSION 2.11.2)
set(APP_ID de.akaflieg_freiburg.enroute)
math(EXPR PROJECT_VERSION_CODE 10000*${PROJECT_VERSION_MAJOR}+100*${PROJECT_VERSION_MINOR}+${PROJECT_VERSION_PATCH})
add_compile_definitions(PROJECT_VERSION="${PROJECT_VERSION}")
Expand Down
16 changes: 16 additions & 0 deletions src/traffic/TrafficDataSource_Tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,22 @@ void Traffic::TrafficDataSource_Tcp::setPassword(const QString& SSID, const QStr
if (SSID != passwordRequest_SSID) {
return;
}

// First case: the device is already delivering data. This happens for Stratux devices
// that request a password for historical reasons, but really do not need one.
// In this case, accept the password immediately and issue a password storage request
// if appropriate
if (receivingHeartbeat()) {
// emit a password storage request if appropriate
auto* passwordDB = Global::passwordDB();
if (!passwordDB->contains(passwordRequest_SSID) ||
(passwordDB->getPassword(passwordRequest_SSID) != passwordRequest_password)) {
emit passwordStorageRequest(passwordRequest_SSID, passwordRequest_password);
}
return;
}

// Second case: the devise is not yet delivering data. This is the normal case.
passwordRequest_password = password;
QTimer::singleShot(0, this, &Traffic::TrafficDataSource_Tcp::sendPassword_internal);
}
Expand Down

0 comments on commit baee949

Please sign in to comment.