Skip to content
Snippets Groups Projects
Commit 6c999d86 authored by Amna Snene's avatar Amna Snene Committed by Adrien Béraud
Browse files

connectionmanager: add deviceId to getConnectionList

Change-Id: I20a08723ae90cb8daf1b35bf7cbbea44ef067dca
parent 6b6a5d30
Branches
Tags
No related merge requests found
...@@ -221,7 +221,8 @@ public: ...@@ -221,7 +221,8 @@ public:
* Note: The connections are represented as maps with string keys and string values. The map * Note: The connections are represented as maps with string keys and string values. The map
* contains the following key-value pairs: * contains the following key-value pairs:
* - "id": The unique identifier of the connection. * - "id": The unique identifier of the connection.
* - "userUri": The user URI associated with the connection (if available). * - "peer": The contact URI associated with the connection (if available).
* - "device": The device URI associated with the connection.
* - "status": The status of the connection, represented as an integer: * - "status": The status of the connection, represented as an integer:
* - 0: ConnectionStatus::Connected * - 0: ConnectionStatus::Connected
* - 1: ConnectionStatus::TLS * - 1: ConnectionStatus::TLS
......
...@@ -1783,9 +1783,11 @@ ConnectionManager::getConnectionList(const DeviceId& device) const ...@@ -1783,9 +1783,11 @@ ConnectionManager::getConnectionList(const DeviceId& device) const
continue; continue;
std::map<std::string, std::string> connectionInfo; std::map<std::string, std::string> connectionInfo;
connectionInfo["id"] = callbackIdToString(key.first, key.second); connectionInfo["id"] = callbackIdToString(key.first, key.second);
if (ci->tls_ && ci->tls_->peerCertificate()) { connectionInfo["device"] = key.first;
auto cert = ci->tls_->peerCertificate(); if (ci->tls_) {
connectionInfo["userUri"] = cert->issuer->getId().toString(); if (auto cert = ci->tls_->peerCertificate()) {
connectionInfo["peer"] = cert->issuer->getId().toString();
}
} }
if (ci->socket_) { if (ci->socket_) {
connectionInfo["status"] = std::to_string(static_cast<int>(ConnectionStatus::Connected)); connectionInfo["status"] = std::to_string(static_cast<int>(ConnectionStatus::Connected));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment