add server/client (S/C) indicator based on ETCP_LINK.is_server in connection monitor, member detail, and Android JSON
This commit is contained in:
1 parent
cf956cf2f0
commit
496f0f7d2b
4 files changed
+29
-32
No files matched your search
@@ -812,6 +812,14 @@ char* utun_bridge_get_member_detail_json(const char* channel_id, uint64_t node_i
|
||||
}
|
||||
|
||||
char peers_tbl[80]; peers_table_name(channel_id, peers_tbl, sizeof(peers_tbl));
|
||||
|
||||
{ /* server/client role */
|
||||
struct ETCP_CONN* detail_conn = NULL;
|
||||
if (g_cc.inst) detail_conn = instance_find_conn(g_cc.inst, node_id);
|
||||
const char* sc = (detail_conn && detail_conn->links)
|
||||
? (detail_conn->links->is_server ? "S" : "C") : "";
|
||||
pos += (size_t)snprintf(buf + pos, sizeof(buf) - pos, ",\"sc\":\"%s\"", sc);
|
||||
}
|
||||
snprintf(buf + pos, sizeof(buf) - pos, ",\"adr\":["); pos += strlen(buf + pos);
|
||||
|
||||
if (sqlite3_prepare_v2(db,
|
||||
|
||||
@@ -154,6 +154,8 @@ void AccountList::showMemberDetail(quint64 nodeId) {
|
||||
m_snapConnPresent = false;
|
||||
m_snapConnUp = false;
|
||||
m_snapConnInit = false;
|
||||
m_snapClient = false;
|
||||
m_snapServer = false;
|
||||
m_snapOwnTcpActive = 0;
|
||||
m_snapLinks.clear();
|
||||
m_snapSocks.clear();
|
||||
@@ -244,6 +246,8 @@ void AccountList::onMemberDetailData(uint64_t nodeId, const uint8_t* data, int l
|
||||
m_snapConnPresent = (flags & 1) != 0;
|
||||
m_snapConnUp = (flags & 2) != 0;
|
||||
m_snapConnInit = (flags & 4) != 0;
|
||||
m_snapClient = (flags & 8) != 0;
|
||||
m_snapServer = (flags & 16) != 0;
|
||||
uint16_t ownTcpActive;
|
||||
memcpy(&ownTcpActive, p, 2); p += 2;
|
||||
m_snapOwnTcpActive = ownTcpActive;
|
||||
@@ -302,8 +306,11 @@ void AccountList::updateDetailDisplay() {
|
||||
lines.append(QString("ID:0x%1").arg(m_detailNodeId, 16, 16, QChar('0')));
|
||||
|
||||
QString dotColor = m_detailOnline ? "#4CAF50" : "#9E9E9E";
|
||||
lines.append(QString("<span style='color:%1;'>●</span> %2")
|
||||
.arg(dotColor, m_detailName.toHtmlEscaped()));
|
||||
QString scLabel;
|
||||
if (m_snapClient) scLabel = " C";
|
||||
else if (m_snapServer) scLabel = " S";
|
||||
lines.append(QString("<span style='color:%1;'>●</span> %2%3")
|
||||
.arg(dotColor, m_detailName.toHtmlEscaped(), scLabel));
|
||||
|
||||
if (m_detailLastSeen > 0)
|
||||
lines.append(QString("⌛ %1").arg(relativeTimeStr(m_detailLastSeen)));
|
||||
|
||||
@@ -89,6 +89,8 @@ private:
|
||||
bool m_snapConnPresent = false;
|
||||
bool m_snapConnUp = false;
|
||||
bool m_snapConnInit = false;
|
||||
bool m_snapClient = false;
|
||||
bool m_snapServer = false;
|
||||
int m_snapOwnTcpActive = 0;
|
||||
QVector<MemberLinkSnap> m_snapLinks;
|
||||
QVector<MemberSockSnap> m_snapSocks;
|
||||
|
||||
Reference in new issue
Block a user