Page MenuHomePhabricator

D5164.diff
No OneTemporary

D5164.diff

diff --git a/services/tunnelbroker/src/Database/DatabaseManager.cpp b/services/tunnelbroker/src/Database/DatabaseManager.cpp
--- a/services/tunnelbroker/src/Database/DatabaseManager.cpp
+++ b/services/tunnelbroker/src/Database/DatabaseManager.cpp
@@ -53,6 +53,9 @@
DeviceSessionItem::FIELD_EXPIRE,
Aws::DynamoDB::Model::AttributeValue(std::to_string(
static_cast<size_t>(std::time(0)) + SESSION_RECORD_TTL)));
+ request.AddItem(
+ DeviceSessionItem::FIELD_IS_ONLINE,
+ Aws::DynamoDB::Model::AttributeValue().SetBool(false));
this->innerPutItem(std::make_shared<DeviceSessionItem>(item), request);
}
diff --git a/services/tunnelbroker/src/Database/DeviceSessionItem.h b/services/tunnelbroker/src/Database/DeviceSessionItem.h
--- a/services/tunnelbroker/src/Database/DeviceSessionItem.h
+++ b/services/tunnelbroker/src/Database/DeviceSessionItem.h
@@ -17,6 +17,7 @@
std::string appVersion;
std::string deviceOs;
int64_t checkpointTime = 0;
+ bool isOnline = false;
void validate() const override;
@@ -30,6 +31,7 @@
static const std::string FIELD_DEVICE_OS;
static const std::string FIELD_CHECKPOINT_TIME;
static const std::string FIELD_EXPIRE;
+ static const std::string FIELD_IS_ONLINE;
PrimaryKeyDescriptor getPrimaryKeyDescriptor() const override;
PrimaryKeyValue getPrimaryKeyValue() const override;
@@ -42,6 +44,7 @@
std::string getAppVersion() const;
std::string getDeviceOs() const;
int64_t getCheckpointTime() const;
+ bool getIsOnline() const;
DeviceSessionItem() {
}
diff --git a/services/tunnelbroker/src/Database/DeviceSessionItem.cpp b/services/tunnelbroker/src/Database/DeviceSessionItem.cpp
--- a/services/tunnelbroker/src/Database/DeviceSessionItem.cpp
+++ b/services/tunnelbroker/src/Database/DeviceSessionItem.cpp
@@ -17,6 +17,7 @@
const std::string DeviceSessionItem::FIELD_DEVICE_OS = "DeviceOS";
const std::string DeviceSessionItem::FIELD_CHECKPOINT_TIME = "CheckpointTime";
const std::string DeviceSessionItem::FIELD_EXPIRE = "Expire";
+const std::string DeviceSessionItem::FIELD_IS_ONLINE = "IsOnline";
DeviceSessionItem::DeviceSessionItem(
const std::string sessionID,
@@ -71,6 +72,8 @@
std::string(
itemFromDB.at(DeviceSessionItem::FIELD_CHECKPOINT_TIME).GetS())
.c_str());
+ this->isOnline =
+ itemFromDB.at(DeviceSessionItem::FIELD_IS_ONLINE).GetBool();
} catch (std::logic_error &e) {
throw std::runtime_error(
"Invalid device session database value " + std::string(e.what()));
@@ -123,6 +126,10 @@
return this->checkpointTime;
}
+bool DeviceSessionItem::getIsOnline() const {
+ return this->isOnline;
+}
+
} // namespace database
} // namespace network
} // namespace comm

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 9:09 AM (8 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2712285
Default Alt Text
D5164.diff (2 KB)

Event Timeline