handle peer IDs better, Peer-Link will mangle some peer IDs and we need to check the peerId embedded in the status update instead of using the raw network peer Id;

pull/75/head
Bryan Biedenkapp 1 year ago
parent 8a0412524a
commit ccab09c191

@ -465,10 +465,8 @@ public:
getNetwork()->unlockPeerStatus(); getNetwork()->unlockPeerStatus();
for (auto entry : peerStatus) { for (auto entry : peerStatus) {
uint32_t peerId = entry.first;
json::object peerObj = entry.second; json::object peerObj = entry.second;
if (peerObj["peerId"].is<uint32_t>()) uint32_t peerId = peerObj["peerId"].getDefault<uint32_t>(entry.first);
peerId = peerObj["peerId"].get<uint32_t>();
auto it = std::find_if(m_nodes.begin(), m_nodes.end(), [&](NodeStatusWidget* wdgt) { auto it = std::find_if(m_nodes.begin(), m_nodes.end(), [&](NodeStatusWidget* wdgt) {
if (wdgt->peerId == peerId && wdgt->uniqueId == (int32_t)peerId) if (wdgt->peerId == peerId && wdgt->uniqueId == (int32_t)peerId)

@ -111,8 +111,9 @@ void PeerNetwork::userPacketHandler(uint32_t peerId, FrameQueue::OpcodePair opco
} }
json::object obj = v.get<json::object>(); json::object obj = v.get<json::object>();
uint32_t actualPeerId = obj["peerId"].getDefault<uint32_t>(peerId);
std::lock_guard<std::mutex> lock(m_peerStatusMutex); std::lock_guard<std::mutex> lock(m_peerStatusMutex);
peerStatus[peerId] = obj; peerStatus[actualPeerId] = obj;
} }
break; break;

Loading…
Cancel
Save

Powered by TurnKey Linux.