etcp: TCP links skip remote keepalive gating; chatgui: show interface names in member detail, fix destructor callbacks

This commit is contained in:
evgeny committed 2026-08-08 07:31:38 +03:00
1 parent 80e77f12c2
commit d453e73ddb
4 files changed
+62 -10

No files matched your search

+46 -4
View File
@@ -10,6 +10,7 @@
#include <QDateTime>
#include <QFont>
#include <QSet>
#include <algorithm>
#include "../../../lib/platform_compat.h"
extern "C" {
@@ -174,7 +175,7 @@ void AccountList::showMemberDetail(quint64 nodeId) {
sqlite3_stmt* na = nullptr;
sqlite3_prepare_v2(d,
"SELECT family, protocol, address, port FROM node_addresses WHERE node_id=? ORDER BY family, port",
"SELECT family, protocol, address, port, socket_id FROM node_addresses WHERE node_id=?",
-1, &na, nullptr);
if (na) {
sqlite3_bind_int64(na, 1, (sqlite3_int64)nodeId);
@@ -185,12 +186,46 @@ void AccountList::showMemberDetail(quint64 nodeId) {
const void* adr = sqlite3_column_blob(na, 2);
int sz = sqlite3_column_bytes(na, 2);
if (adr && sz > 0) a.addr = QByteArray((const char*)adr, sz);
a.port = sqlite3_column_int(na, 3);
a.port = sqlite3_column_int(na, 3);
a.socket_id = sqlite3_column_int(na, 4);
if (!a.addr.isEmpty()) m_detailAddrs.append(a);
}
sqlite3_finalize(na);
}
/* resolve interface names from live sockets and sort */
if (m_inst) {
for (auto& a : m_detailAddrs) {
if (a.protocol == 1) {
for (struct ETCP_SOCKET* s = m_inst->etcp_sockets; s; s = s->next) {
if ((int)s->sock_id == a.socket_id) {
QString name = QString::fromLatin1(s->name);
int idx = name.lastIndexOf("_v");
if (idx > 3) a.ifname = name.mid(3, idx - 3);
break;
}
}
} else if (a.protocol == 2) {
for (struct TCP_SOCKET* ts = m_inst->tcp_sockets; ts; ts = ts->next) {
if ((int)ts->sock_id == a.socket_id) {
QString name = QString::fromLatin1(ts->name);
int idx = name.lastIndexOf("_v");
if (idx > 3) a.ifname = name.mid(3, idx - 3);
break;
}
}
}
}
}
std::sort(m_detailAddrs.begin(), m_detailAddrs.end(),
[](const DetailAddress& a, const DetailAddress& b) {
if (a.ifname != b.ifname) return a.ifname < b.ifname;
if (a.addr != b.addr) return a.addr < b.addr;
if (a.protocol != b.protocol) return a.protocol < b.protocol;
return a.port < b.port;
});
m_detailTimer->start();
m_linkTimer->start();
updateDetailDisplay();
@@ -292,8 +327,15 @@ void AccountList::updateDetailDisplay() {
if (linkCount > 0) prefix = QString("[%1] ").arg(linkCount);
}
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));
if (!a.ifname.isEmpty()) {
lines.append(QString("%1<span style='color:%2;'>●</span> %3 %4")
.arg(prefix, linkColor, proto, a.ifname));
lines.append(QString("&nbsp;&nbsp;%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));
}
}
/* Show ETCP links that are not in DB (non-self) */