diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c04fdb..f114ebd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.3] Q3 2022 + - fixed SAS Token expired handling + - bump to azure-iot-sdk 0.8.3 + ## [0.4.2] Q3 2022 - bump to azure-iot-sdk 0.8.2 @@ -19,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - bump to azure-iot-sdk 0.8.1 ## [0.3.1] Q2 2022 - - fixed readme + - fixed readme ## [0.3.0] Q2 2022 - bump to azure-iot-sdk 0.8.0: @@ -40,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - notify watchdog ## [0.2.1] Q1 2022 - - add D2C messages + - add D2C messages ## [0.2.0] Q1 2022 - renamed package and repo to iot-module-template-rs diff --git a/Cargo.lock b/Cargo.lock index 24e1d15..d499f01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -182,8 +182,8 @@ dependencies = [ [[package]] name = "azure-iot-sdk" -version = "0.8.2" -source = "git+ssh://git@github.com/ICS-DeviceManagement/azure-iot-sdk.git?tag=0.8.2#439595f47688cb5f3d78a7862742cbc551588cec" +version = "0.8.3" +source = "git+ssh://git@github.com/ICS-DeviceManagement/azure-iot-sdk.git?tag=0.8.3#fb30e8fd71f02b596858f24e49de5763a534dbc7" dependencies = [ "azure-iot-sdk-sys", "eis-utils", @@ -194,8 +194,8 @@ dependencies = [ [[package]] name = "azure-iot-sdk-sys" -version = "0.5.0" -source = "git+ssh://git@github.com/ICS-DeviceManagement/azure-iot-sdk-sys.git?tag=0.5.0#0acdf6a7ac32a21b57bbb44b640f91a427a30ae4" +version = "0.5.1" +source = "git+ssh://git@github.com/ICS-DeviceManagement/azure-iot-sdk-sys.git?tag=0.5.1#0024059836411a8f6b8f54f3061d31f2a2fef1db" dependencies = [ "bindgen", "pkg-config", @@ -800,7 +800,7 @@ dependencies = [ [[package]] name = "iot-client-template-rs" -version = "0.4.2" +version = "0.4.3" dependencies = [ "azure-iot-sdk", "env_logger 0.8.4", diff --git a/Cargo.toml b/Cargo.toml index e94a209..78a643a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iot-client-template-rs" -version = "0.4.2" +version = "0.4.3" edition = "2021" authors = ["Joerg Zeidler ", "Jan Zachmann "] repository = "git@github.com:ICS-DeviceManagement/iot-client-template-rs.git" @@ -10,7 +10,7 @@ license = "MIT OR Apache-2.0" [dependencies] # use either device_client, module_client or edge_client -azure-iot-sdk = { git = "ssh://git@github.com/ICS-DeviceManagement/azure-iot-sdk.git", tag = "0.8.2", default-features = false } +azure-iot-sdk = { git = "ssh://git@github.com/ICS-DeviceManagement/azure-iot-sdk.git", tag = "0.8.3", default-features = false } sd-notify = { git = "ssh://git@github.com/ICS-DeviceManagement/sd-notify.git", tag = "v0.5.0", optional = true } serde_json = "1.0" env_logger = "0.8" diff --git a/src/lib.rs b/src/lib.rs index c3c8adb..b031ba7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ pub mod systemd; pub mod twin; use azure_iot_sdk::client::*; use client::{Client, Message}; -use log::{debug, error}; +use log::{info, debug, error}; use std::sync::{mpsc, Arc, Mutex}; #[tokio::main] @@ -30,11 +30,17 @@ pub async fn run() -> Result<(), IotError> { } } Message::Unauthenticated(reason) => { - client.stop().await.unwrap(); - return Err(IotError::from(format!( - "No connection. Reason: {:?}", - reason - ))); + if let UnauthenticatedReason::ExpiredSasToken = reason { + info!("SAS Token expired, SDK will try to refresh the token automatically"); + } + else { + client.stop().await.unwrap(); + return Err(IotError::from(format!( + "No connection. Reason: {:?}", + reason + ))); + } + } Message::Desired(state, desired) => { twin::update(state, desired, Arc::clone(&tx_app2client));