|
|
|
|
@ -154,8 +154,6 @@ 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(); |
|
|
|
|
@ -246,8 +244,6 @@ 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; |
|
|
|
|
@ -261,10 +257,11 @@ void AccountList::onMemberDetailData(uint64_t nodeId, const uint8_t* data, int l
|
|
|
|
|
lk.linkState = p[1]; |
|
|
|
|
lk.linkStatus = p[2]; |
|
|
|
|
lk.tcpReady = p[3] != 0; |
|
|
|
|
lk.family = p[4]; |
|
|
|
|
int addrLen = p[5]; |
|
|
|
|
lk.addr = QByteArray((const char*)p + 6, qMin(addrLen, 16)); |
|
|
|
|
memcpy(&lk.port, p + 22, 2); |
|
|
|
|
lk.isServer = p[4] != 0; |
|
|
|
|
lk.family = p[5]; |
|
|
|
|
int addrLen = p[6]; |
|
|
|
|
lk.addr = QByteArray((const char*)p + 7, qMin(addrLen, 16)); |
|
|
|
|
memcpy(&lk.port, p + 23, 2); |
|
|
|
|
p += MEMBER_DETAIL_LINK_SIZE; |
|
|
|
|
m_snapLinks.append(lk); |
|
|
|
|
} |
|
|
|
|
@ -306,11 +303,8 @@ void AccountList::updateDetailDisplay() {
|
|
|
|
|
lines.append(QString("ID:0x%1").arg(m_detailNodeId, 16, 16, QChar('0'))); |
|
|
|
|
|
|
|
|
|
QString dotColor = m_detailOnline ? "#4CAF50" : "#9E9E9E"; |
|
|
|
|
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)); |
|
|
|
|
lines.append(QString("<span style='color:%1;'>●</span> %2") |
|
|
|
|
.arg(dotColor, m_detailName.toHtmlEscaped())); |
|
|
|
|
|
|
|
|
|
if (m_detailLastSeen > 0) |
|
|
|
|
lines.append(QString("⌛ %1").arg(relativeTimeStr(m_detailLastSeen))); |
|
|
|
|
@ -323,18 +317,19 @@ void AccountList::updateDetailDisplay() {
|
|
|
|
|
for (const auto& a : m_detailAddrs) { |
|
|
|
|
QString proto; |
|
|
|
|
switch (a.protocol) { case 1: proto = "UDP"; break; case 2: proto = "TCP"; break; default: proto = "UDP/TCP"; break; } |
|
|
|
|
QString linkColor = "#9E9E9E"; |
|
|
|
|
QString linkColor = "#9E9E9E"; QString scRole; |
|
|
|
|
if (m_snapConnPresent) { |
|
|
|
|
for (const auto& lk : m_snapLinks) { |
|
|
|
|
if (lk.family == a.family && lk.port == a.port |
|
|
|
|
&& lk.addr == a.addr) { |
|
|
|
|
linkColor = (lk.linkState == 3 && lk.linkStatus == 1) ? "#4CAF50" : "#E53935"; |
|
|
|
|
scRole = lk.isServer ? " S" : " C"; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (linkColor == "#9E9E9E" && a.protocol == 2) { |
|
|
|
|
for (const auto& lk : m_snapLinks) { |
|
|
|
|
if (lk.isTcp && lk.tcpReady) { linkColor = "#4CAF50"; break; } |
|
|
|
|
if (lk.isTcp && lk.tcpReady) { linkColor = "#4CAF50"; scRole = lk.isServer ? " S" : " C"; break; } |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -353,13 +348,13 @@ void AccountList::updateDetailDisplay() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!a.ifname.isEmpty()) { |
|
|
|
|
lines.append(QString("%1<span style='color:%2;'>●</span> %3 %4") |
|
|
|
|
.arg(prefix, linkColor, proto, a.ifname)); |
|
|
|
|
lines.append(QString("%1<span style='color:%2;'>●</span> %3%4 %5") |
|
|
|
|
.arg(prefix, linkColor, proto, scRole, a.ifname)); |
|
|
|
|
lines.append(QString(" %1:<span style='color:#FF9800;'>%2</span>") |
|
|
|
|
.arg(addrStr(a.addr.constData(), a.family)).arg(a.port)); |
|
|
|
|
} else { |
|
|
|
|
lines.append(QString("%1<span style='color:%2;'>●</span> %3:%4:%5") |
|
|
|
|
.arg(prefix, linkColor, proto, addrStr(a.addr.constData(), a.family)).arg(a.port)); |
|
|
|
|
lines.append(QString("%1<span style='color:%2;'>●</span> %3%4:%5:%6") |
|
|
|
|
.arg(prefix, linkColor, proto, scRole, addrStr(a.addr.constData(), a.family)).arg(a.port)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -374,9 +369,10 @@ void AccountList::updateDetailDisplay() {
|
|
|
|
|
} |
|
|
|
|
if (matched) continue; |
|
|
|
|
QString proto = lk.isTcp ? "TCP" : "UDP"; |
|
|
|
|
QString sc = lk.isServer ? " S" : " C"; |
|
|
|
|
QString lc = (lk.linkState == 3 && lk.linkStatus == 1) ? "#4CAF50" : "#E53935"; |
|
|
|
|
lines.append(QString("<span style='color:%1;'>●</span> %2:%3:%4 [link]") |
|
|
|
|
.arg(lc, proto, addrStr(lk.addr.constData(), lk.family)).arg(lk.port)); |
|
|
|
|
lines.append(QString("<span style='color:%1;'>●</span> %2%3:%4:%5 [link]") |
|
|
|
|
.arg(lc, proto, sc, addrStr(lk.addr.constData(), lk.family)).arg(lk.port)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|