From 038336f2371673f89d274b03a9f7595e0a8a78c6 Mon Sep 17 00:00:00 2001 From: Harsh Gandhi <63674702+HarshGandhi-AWS@users.noreply.github.com> Date: Wed, 8 Jun 2022 09:32:14 -0700 Subject: [PATCH 1/7] Removed ST feature stop code from connection shutdown callback. (#279) --- source/tunneling/SecureTunnelingFeature.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/source/tunneling/SecureTunnelingFeature.cpp b/source/tunneling/SecureTunnelingFeature.cpp index e4df0e38e..e1129e65b 100644 --- a/source/tunneling/SecureTunnelingFeature.cpp +++ b/source/tunneling/SecureTunnelingFeature.cpp @@ -265,13 +265,6 @@ namespace Aws return c.get() == contextToRemove; }); mContexts.erase(std::remove(mContexts.begin(), mContexts.end(), *it)); - -#if defined(DISABLE_MQTT) - if (mContexts.empty()) - { - stop(); - } -#endif } } // namespace SecureTunneling From fc64b02034759af2a14362b282592890e2c1314c Mon Sep 17 00:00:00 2001 From: Harsh Gandhi <63674702+HarshGandhi-AWS@users.noreply.github.com> Date: Wed, 8 Jun 2022 10:22:40 -0700 Subject: [PATCH 2/7] Add --version CLI option (#280) * Add --version CLI option * updated DC version * undone the version update in file .version Co-authored-by: marco morais <93558171+marcoemorais-aws@users.noreply.github.com> --- .version | 2 +- source/config/Config.cpp | 22 ++++++++++++++++------ source/config/Config.h | 2 ++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.version b/.version index d3ef87965..87226c2ab 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -v1.6.0-31d162e*v1.6*1*6*0*0*31d162e +v1.6.0-31d162e*v1.6*1*6*0*0*31d162e \ No newline at end of file diff --git a/source/config/Config.cpp b/source/config/Config.cpp index 5898125db..4f5190c26 100644 --- a/source/config/Config.cpp +++ b/source/config/Config.cpp @@ -20,6 +20,7 @@ #include "../util/FileUtils.h" #include "../util/MqttUtils.h" #include "../util/StringUtils.h" +#include "Version.h" #include #include @@ -1978,6 +1979,7 @@ constexpr char Config::DEFAULT_CONFIG_DIR[]; constexpr char Config::DEFAULT_KEY_DIR[]; constexpr char Config::DEFAULT_CONFIG_FILE[]; constexpr char Config::CLI_HELP[]; +constexpr char Config::CLI_VERSION[]; constexpr char Config::CLI_EXPORT_DEFAULT_SETTINGS[]; constexpr char Config::CLI_CONFIG_FILE[]; constexpr char Config::DEFAULT_FLEET_PROVISIONING_RUNTIME_CONFIG_FILE[]; @@ -1995,6 +1997,7 @@ bool Config::ParseCliArgs(int argc, char **argv, CliArgs &cliArgs) }; ArgumentDefinition argumentDefinitions[] = { {CLI_HELP, false, true, [](const string &additionalArg) { PrintHelpMessage(); }}, + {CLI_VERSION, false, true, [](const string &additionalArg) { PrintVersion(); }}, {CLI_EXPORT_DEFAULT_SETTINGS, true, true, @@ -2252,6 +2255,7 @@ void Config::PrintHelpMessage() "Available sub-commands:\n" "\n" "%s:\t\t\t\t\t\t\t\t\tGet more help on commands\n" + "%s:\t\t\t\t\t\t\t\tOutput current version\n" "%s :\t\t\t\tExport default settings for the AWS IoT Device Client binary to the specified " "file " "and exit " @@ -2268,14 +2272,14 @@ void Config::PrintHelpMessage() "%s [true|false]:\t\t\t\t\tEnables/Disables Device Defender feature\n" "%s [true|false]:\t\t\t\tEnables/Disables Fleet Provisioning feature\n" "%s [true|false]:\t\t\t\t\t\tEnables/Disables Pub/Sub Sample feature\n" - "%s [true|false]:\t\t\t\t\t\tEnables/Disables Sample Shadow feature\n" - "%s [true|false]:\t\t\t\t\t\tEnables/Disables Config Shadow feature\n" + "%s [true|false]:\t\t\t\t\tEnables/Disables Sample Shadow feature\n" + "%s [true|false]:\t\t\t\t\tEnables/Disables Config Shadow feature\n" "%s [true|false]:\t\t\t\t\t\tEnables/Disables Secure Element Configuration\n" "%s :\t\t\t\t\t\tUse Specified Endpoint\n" "%s :\t\t\t\t\t\t\tUse Specified Cert file\n" "%s :\t\t\t\t\t\t\tUse Specified Key file\n" "%s :\t\t\t\t\t\tUse Specified Root-CA file\n" - "%s :\t\t\t\t\tUse Specified Thing Name (Also used as Client ID)\n" + "%s :\t\t\tUse Specified Thing Name (Also used as Client ID)\n" "%s :\t\t\t\tUse specified directory to find job handlers\n" "%s :\t\t\t\t\t\tUse Specified AWS Region for Secure Tunneling\n" "%s :\t\t\t\t\t\tConnect secure tunnel to specific service\n" @@ -2295,9 +2299,9 @@ void Config::PrintHelpMessage() "%s :\t\t\t\t\tThe file the Pub/Sub sample feature will read from when publishing\n" "%s :\t\t\t\t\tThe topic the Pub/Sub sample feature will receive messages on\n" "%s :\t\t\t\t\tThe file the Pub/Sub sample feature will write received messaged to\n" - "%s :\t\t\t\t\tThe name of shadow SampleShadow feature will create or update\n" - "%s :\t\t\t\t\tThe file the Sample Shadow feature will read from when updating shadow data\n" - "%s :\t\t\t\t\tThe file the Sample Shadow feature will write the latest shadow document " + "%s :\t\t\t\t\t\tThe name of shadow SampleShadow feature will create or update\n" + "%s :\t\t\t\tThe file the Sample Shadow feature will read from when updating shadow data\n" + "%s :\t\t\t\tThe file the Sample Shadow feature will write the latest shadow document " "to\n" "%s :\t\t\t\t\tThe file path to PKCS#11 library\n" "%s :\t\t\t\t\tThe user PIN for logging into PKCS#11 token.\n" @@ -2308,6 +2312,7 @@ void Config::PrintHelpMessage() cout << FormatMessage( helpMessageTemplate, CLI_HELP, + CLI_VERSION, CLI_EXPORT_DEFAULT_SETTINGS, CLI_CONFIG_FILE, PlainConfig::LogConfig::CLI_LOG_LEVEL, @@ -2352,6 +2357,11 @@ void Config::PrintHelpMessage() PlainConfig::SecureElement::CLI_SECURE_ELEMENT_TOKEN_LABEL); } +void Config::PrintVersion() +{ + cout << DEVICE_CLIENT_VERSION_FULL << endl; +} + bool Config::ExportDefaultSetting(const string &file) { string jsonTemplate = R"({ diff --git a/source/config/Config.h b/source/config/Config.h index f86dc35ba..80819ba00 100644 --- a/source/config/Config.h +++ b/source/config/Config.h @@ -441,6 +441,7 @@ namespace Aws static constexpr char DEFAULT_SAMPLE_SHADOW_OUTPUT_DIR[] = "~/.aws-iot-device-client/sample-shadow/"; static constexpr char CLI_HELP[] = "--help"; + static constexpr char CLI_VERSION[] = "--version"; static constexpr char CLI_EXPORT_DEFAULT_SETTINGS[] = "--export-default-settings"; static constexpr char CLI_CONFIG_FILE[] = "--config-file"; @@ -469,6 +470,7 @@ namespace Aws private: static void PrintHelpMessage(); + static void PrintVersion(); static bool ExportDefaultSetting(const std::string &file); }; } // namespace DeviceClient From bfd2a0f24df9996efbb9715262c18361ac4bf90f Mon Sep 17 00:00:00 2001 From: marco morais <93558171+marcoemorais-aws@users.noreply.github.com> Date: Mon, 13 Jun 2022 08:40:13 -0700 Subject: [PATCH 3/7] Separate sensor publish socket file and directory permissions (#285) --- docs/PERMISSIONS.md | 1 + source/config/Config.cpp | 2 +- source/config/Config.h | 1 + test/config/TestConfig.cpp | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/PERMISSIONS.md b/docs/PERMISSIONS.md index 3ef4f0796..85f5cbf8e 100644 --- a/docs/PERMISSIONS.md +++ b/docs/PERMISSIONS.md @@ -36,6 +36,7 @@ Directory Storing CSR File | 700 | **Yes** Directory Storing Log File | 745 | **Yes** Directory Storing Config Files | 745 | **Recommended** Directory Storing PubSub File | 745 | **Yes** +Directory Storing Sensor Publish Pathname Socket | 700 | **Yes** Directory Storing PKCS11 Library File | 700 | **Yes** *Note: It is worth noting here that files are directories storing these files created by AWS IoT Device Client will have the above mentioned permissions set by default* diff --git a/source/config/Config.cpp b/source/config/Config.cpp index 4f5190c26..cc27f905f 100644 --- a/source/config/Config.cpp +++ b/source/config/Config.cpp @@ -1829,7 +1829,7 @@ bool PlainConfig::SensorPublish::Validate() const // If the path does not point to an existing file, // then check the parent directory exists and has required permissions. auto addrParentDir = FileUtils::ExtractParentDirectory(setting.addr.value()); - if (!FileUtils::ValidateFilePermissions(addrParentDir, Permissions::SENSOR_PUBLISH_ADDR_FILE)) + if (!FileUtils::ValidateFilePermissions(addrParentDir, Permissions::SENSOR_PUBLISH_ADDR_DIR)) { setting.enabled = false; } diff --git a/source/config/Config.h b/source/config/Config.h index 80819ba00..8f98b3a9c 100644 --- a/source/config/Config.h +++ b/source/config/Config.h @@ -58,6 +58,7 @@ namespace Aws static constexpr int PUB_SUB_FILES = 600; static constexpr int SAMPLE_SHADOW_FILES = 600; static constexpr int SENSOR_PUBLISH_ADDR_FILE = 660; + static constexpr int SENSOR_PUBLISH_ADDR_DIR = 700; static constexpr int PKCS11_LIB_FILE = 640; }; diff --git a/test/config/TestConfig.cpp b/test/config/TestConfig.cpp index b65b8f750..469a25845 100644 --- a/test/config/TestConfig.cpp +++ b/test/config/TestConfig.cpp @@ -50,7 +50,7 @@ class ConfigTestFixture : public ::testing::Test // Ensure invalid-file does not exist std::remove(invalidFilePath.c_str()); - mode_t validPerms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; + mode_t validPerms = S_IRUSR | S_IWUSR | S_IXUSR; FileUtils::CreateDirectoryWithPermissions(addrPathValid.c_str(), validPerms); mode_t invalidPerms = validPerms | S_IRWXO; @@ -1578,4 +1578,4 @@ TEST(Config, MemoryTrace) ASSERT_TRUE(config.LoadFromEnvironment()) << "read AWS_CRT_MEMORY_TRACING=" << level; ASSERT_EQ(config.memTraceLevel, level); } -} \ No newline at end of file +} From 92775dd6b6ab952e8f23bb48f6250ca390ae53ea Mon Sep 17 00:00:00 2001 From: RogerZhongAWS <100961047+RogerZhongAWS@users.noreply.github.com> Date: Tue, 14 Jun 2022 08:31:36 -0700 Subject: [PATCH 4/7] Fix for cross compile issue (#274) remove double calls to cmake --- .github/build.sh | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.github/build.sh b/.github/build.sh index 1ed24bd18..c3ed42471 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -125,17 +125,12 @@ case $compileMode in cd .. if [ "$stMode" = true ]; then # Set CMake flags for ST mode - # Fix for the Cmake executing build of the sdk which errors out linking incorrectly to openssl - cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-armhf.cmake -DBUILD_SDK=ON -DEXCLUDE_JOBS=ON -DEXCLUDE_DD=ON -DEXCLUDE_FP=ON -DDISABLE_MQTT=ON ../ || true cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-armhf.cmake -DBUILD_SDK=ON -DEXCLUDE_JOBS=ON -DEXCLUDE_DD=ON -DEXCLUDE_FP=ON -DDISABLE_MQTT=ON ../ elif [ "$sharedLibs" = true ]; then - cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-armhf.cmake -DBUILD_SDK=ON ../ || true cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-armhf.cmake -DBUILD_SDK=ON ../ make install DESTDIR=./shared_install_dir chmod 0777 ./shared_install_dir else - # Fix for the Cmake executing build of the sdk which errors out linking incorrectly to openssl - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-armhf.cmake ../ || true cmake -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-armhf.cmake ../ fi cmake --build . --target aws-iot-device-client @@ -161,15 +156,12 @@ case $compileMode in make -j 4 make install cd .. - # Fix for the Cmake executing build of the sdk which errors out linking incorrectly to openssl if [ "$sharedLibs" = true ]; then - cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-mips.cmake ../ || true - cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-mips.cmake ../ + cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-mips.cmake -DS2N_NO_PQ=ON ../ make install DESTDIR=./shared_install_dir chmod 0777 ./shared_install_dir else - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-mips.cmake ../ || true - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-mips.cmake ../ + cmake -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-mips.cmake -DS2N_NO_PQ=ON ../ fi cmake --build . --target aws-iot-device-client cmake --build . --target test-aws-iot-device-client @@ -196,17 +188,12 @@ case $compileMode in cd .. if [ "$stMode" = true ]; then # Set CMake flags for ST mode - # Fix for the Cmake executing build of the sdk which errors out linking incorrectly to openssl - cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-aarch64.cmake -DBUILD_SDK=ON -DEXCLUDE_JOBS=ON -DEXCLUDE_DD=ON -DEXCLUDE_FP=ON -DDISABLE_MQTT=ON ../ || true cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-aarch64.cmake -DBUILD_SDK=ON -DEXCLUDE_JOBS=ON -DEXCLUDE_DD=ON -DEXCLUDE_FP=ON -DDISABLE_MQTT=ON ../ elif [ "$sharedLibs" = true ]; then - cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-aarch64.cmake -DBUILD_SDK=ON ../ || true cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-aarch64.cmake -DBUILD_SDK=ON ../ make install DESTDIR=./shared_install_dir chmod 0777 ./shared_install_dir else - # Fix for the Cmake executing build of the sdk which errors out linking incorrectly to openssl - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-aarch64.cmake ../ || true cmake -DCMAKE_TOOLCHAIN_FILE=../cmake-toolchain/Toolchain-aarch64.cmake ../ fi cmake --build . --target aws-iot-device-client From 4da76567f02ef5a597abc648823673e1d1335635 Mon Sep 17 00:00:00 2001 From: Asad Syed Date: Thu, 16 Jun 2022 04:10:57 +0500 Subject: [PATCH 5/7] Issue 283 (#284) Improves the setup.sh file and systemd service file by parameterizing the config file path --- setup.sh | 1 + setup/aws-iot-device-client.service | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 645a0015f..d1d9e3e13 100755 --- a/setup.sh +++ b/setup.sh @@ -374,6 +374,7 @@ if [ "$INSTALL_SERVICE" = "y" ]; then printf ${PMPT} "Installing AWS IoT Device Client..." if command -v "systemctl" &>/dev/null; then systemctl stop aws-iot-device-client.service || true + sed -i "s#/etc/.aws-iot-device-client/aws-iot-device-client.conf#$CONF_OUTPUT_PATH#g" $SERVICE_FILE cp "$SERVICE_FILE" /etc/systemd/system/aws-iot-device-client.service if [ "$SERVICE_DEBUG" = "y" ]; then echo "$DEBUG_SCRIPT" | tee /sbin/aws-iot-device-client >/dev/null diff --git a/setup/aws-iot-device-client.service b/setup/aws-iot-device-client.service index c6f7a466d..bffe7f124 100644 --- a/setup/aws-iot-device-client.service +++ b/setup/aws-iot-device-client.service @@ -4,7 +4,8 @@ Wants=network-online.target After=network.target network-online.target [Service] -ExecStart=/sbin/aws-iot-device-client --config-file /etc/.aws-iot-device-client/aws-iot-device-client.conf +Environment="CONF_PATH=/etc/.aws-iot-device-client/aws-iot-device-client.conf" +ExecStart=/sbin/aws-iot-device-client --config-file $CONF_PATH [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target From 46eff6ce014e60aa84b20cc2a6b15c073152a5d4 Mon Sep 17 00:00:00 2001 From: Harsh Gandhi <63674702+HarshGandhi-AWS@users.noreply.github.com> Date: Wed, 22 Jun 2022 15:32:06 -0700 Subject: [PATCH 6/7] Resolve Secure Tunneling race condition bug. (#281) * resolved secure tunneling race condition bug. * Added null check before closing tunnel * resolved secure tunneling race condition while closing tunnel connection --- .github/docker-images/amazonlinux/Dockerfile | 2 +- .github/docker-images/ubi8/Dockerfile | 2 +- .github/docker-images/ubuntu-18-x64/Dockerfile | 2 +- CMakeLists.txt.awssdk | 2 +- source/tunneling/SecureTunnelingContext.cpp | 15 ++++++++++++++- source/tunneling/SecureTunnelingContext.h | 5 +++++ source/tunneling/SecureTunnelingFeature.cpp | 3 ++- 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/docker-images/amazonlinux/Dockerfile b/.github/docker-images/amazonlinux/Dockerfile index c06341943..5e6a1afcd 100755 --- a/.github/docker-images/amazonlinux/Dockerfile +++ b/.github/docker-images/amazonlinux/Dockerfile @@ -84,7 +84,7 @@ RUN mkdir sdk-cpp-workspace \ && cd sdk-cpp-workspace \ && git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git \ && cd aws-iot-device-sdk-cpp-v2 \ - && git checkout 975dcefbd422604b939ff916751bf7b11ac05d14 \ + && git checkout ac3ba3774b031dde1b988e698880d6064d53b9d9 \ && git submodule update --init --recursive \ && cd .. \ && mkdir aws-iot-device-sdk-cpp-v2-build \ diff --git a/.github/docker-images/ubi8/Dockerfile b/.github/docker-images/ubi8/Dockerfile index c48c446b6..092c9018a 100644 --- a/.github/docker-images/ubi8/Dockerfile +++ b/.github/docker-images/ubi8/Dockerfile @@ -96,7 +96,7 @@ RUN mkdir sdk-cpp-workspace \ && cd sdk-cpp-workspace \ && git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git \ && cd aws-iot-device-sdk-cpp-v2 \ - && git checkout 975dcefbd422604b939ff916751bf7b11ac05d14 \ + && git checkout ac3ba3774b031dde1b988e698880d6064d53b9d9 \ && git submodule update --init --recursive \ && cd .. \ && mkdir aws-iot-device-sdk-cpp-v2-build \ diff --git a/.github/docker-images/ubuntu-18-x64/Dockerfile b/.github/docker-images/ubuntu-18-x64/Dockerfile index b3e780280..83aa389e9 100644 --- a/.github/docker-images/ubuntu-18-x64/Dockerfile +++ b/.github/docker-images/ubuntu-18-x64/Dockerfile @@ -73,7 +73,7 @@ RUN mkdir sdk-cpp-workspace \ && cd sdk-cpp-workspace \ && git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git \ && cd aws-iot-device-sdk-cpp-v2 \ - && git checkout 975dcefbd422604b939ff916751bf7b11ac05d14 \ + && git checkout ac3ba3774b031dde1b988e698880d6064d53b9d9 \ && git submodule update --init --recursive \ && cd .. \ && mkdir aws-iot-device-sdk-cpp-v2-build \ diff --git a/CMakeLists.txt.awssdk b/CMakeLists.txt.awssdk index 4bf1a42a6..c1dbc21be 100644 --- a/CMakeLists.txt.awssdk +++ b/CMakeLists.txt.awssdk @@ -5,7 +5,7 @@ project(aws-iot-device-sdk-cpp-v2-download NONE) include(ExternalProject) ExternalProject_Add(aws-iot-device-sdk-cpp-v2 GIT_REPOSITORY https://github.com/aws/aws-iot-device-sdk-cpp-v2.git - GIT_TAG 975dcefbd422604b939ff916751bf7b11ac05d14 + GIT_TAG ac3ba3774b031dde1b988e698880d6064d53b9d9 SOURCE_DIR "${CMAKE_BINARY_DIR}/aws-iot-device-sdk-cpp-v2-src" BINARY_DIR "${CMAKE_BINARY_DIR}/aws-iot-device-sdk-cpp-v2-build" CONFIGURE_COMMAND "" diff --git a/source/tunneling/SecureTunnelingContext.cpp b/source/tunneling/SecureTunnelingContext.cpp index d4cc426ef..8d052a106 100644 --- a/source/tunneling/SecureTunnelingContext.cpp +++ b/source/tunneling/SecureTunnelingContext.cpp @@ -33,7 +33,20 @@ namespace Aws { } - SecureTunnelingContext::~SecureTunnelingContext() { mSecureTunnel->Close(); } + SecureTunnelingContext::~SecureTunnelingContext() + { + LOG_DEBUG(TAG, "SecureTunnelingContext::~SecureTunnelingContext"); + if (mSecureTunnel->IsValid()) + { + mSecureTunnel->Close(); + } + } + + void SecureTunnelingContext::StopSecureTunnel() + { + LOG_DEBUG(TAG, "SecureTunnelingContext::StopSecureTunnel"); + mSecureTunnel->Shutdown(); + } template static bool operator==(const Aws::Crt::Optional &lhs, const Aws::Crt::Optional &rhs) diff --git a/source/tunneling/SecureTunnelingContext.h b/source/tunneling/SecureTunnelingContext.h index 66ea990a8..e07ef311b 100644 --- a/source/tunneling/SecureTunnelingContext.h +++ b/source/tunneling/SecureTunnelingContext.h @@ -67,6 +67,11 @@ namespace Aws */ bool ConnectToSecureTunnel(); + /** + * \brief Stop and close secure tunnel + */ + void StopSecureTunnel(); + private: /** * \brief Connect to local TCP forward diff --git a/source/tunneling/SecureTunnelingFeature.cpp b/source/tunneling/SecureTunnelingFeature.cpp index e1129e65b..8e1fa195a 100644 --- a/source/tunneling/SecureTunnelingFeature.cpp +++ b/source/tunneling/SecureTunnelingFeature.cpp @@ -62,9 +62,10 @@ namespace Aws int SecureTunnelingFeature::stop() { + LOG_DEBUG(TAG, "SecureTunnelingFeature::stop"); for (auto &c : mContexts) { - c.reset(); + c->StopSecureTunnel(); } auto self = static_cast(this); From d01e190d38881a97a492f63a88dc5827c8e89dbb Mon Sep 17 00:00:00 2001 From: Tim Hahn <105500809+climbertjh2@users.noreply.github.com> Date: Fri, 1 Jul 2022 13:40:24 -0400 Subject: [PATCH 7/7] fix if statements (#286) --- setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index d1d9e3e13..8bce1e156 100755 --- a/setup.sh +++ b/setup.sh @@ -187,7 +187,7 @@ if [ "$BUILD_CONFIG" = "y" ]; then read -r PUB_TOPIC printf ${PMPT} "Specify the path of a file for the feature to publish (if no path is provided, will default to ${PUB_FILE}):" read -r PUB_FILE_TMP - if [ "$PUB_FILE_TMP"]; then + if [ "$PUB_FILE_TMP" ]; then PUB_FILE=$PUB_FILE_TMP PUB_FILE_PROVIDED="y" fi @@ -195,7 +195,7 @@ if [ "$BUILD_CONFIG" = "y" ]; then read -r SUB_TOPIC printf ${PMPT} "Specify the path of a file for the feature to write to (if no path is provided, will default to ${SUB_FILE}):" read -r SUB_FILE_TMP - if [ "$SUB_FILE_TMP"]; then + if [ "$SUB_FILE_TMP" ]; then SUB_FILE=$SUB_FILE_TMP SUB_FILE_PROVIDED="y" fi