This commit is contained in:
Grégoire Roussel 2024-08-09 01:27:30 +02:00
parent 584a1c8b56
commit b9323c1029
4 changed files with 17 additions and 9 deletions

View File

@ -456,7 +456,7 @@ static void UpdateBroadcastClients()
auto parsedMessageOpt = tracy::ParseBroadcastMessage(msg, len);
if (parsedMessageOpt.has_value())
{
auto parsedMessage = parsedMessageOpt.value();
auto parsedMessage = parsedMessageOpt.value();
auto address = addr.GetText();
const auto clientId = tracy::ClientUniqueID(addr, parsedMessage.listenPort);
const auto ipNumerical = addr.GetNumber();
@ -478,16 +478,24 @@ static void UpdateBroadcastClients()
} );
}
resolvLock.unlock();
clients.emplace( clientId, ClientData { time, parsedMessage.protocolVersion, parsedMessage.activeTime, parsedMessage.listenPort, parsedMessage.pid, parsedMessage.programName, std::move( ip ) } );
clients.emplace(clientId,
ClientData{time,
parsedMessage.protocolVersion,
parsedMessage.activeTime,
parsedMessage.listenPort,
parsedMessage.pid,
parsedMessage.programName,
std::move(ip)});
}
else
{
it->second.time = time;
it->second.activeTime = parsedMessage.activeTime;
it->second.port = parsedMessage.listenPort;
it->second.pid = parsedMessage.pid;
it->second.activeTime = parsedMessage.activeTime;
it->second.port = parsedMessage.listenPort;
it->second.pid = parsedMessage.pid;
it->second.protocolVersion = parsedMessage.protocolVersion;
if( strcmp( it->second.procName.c_str(), parsedMessage.programName ) != 0 ) it->second.procName = parsedMessage.programName;
if (strcmp(it->second.procName.c_str(), parsedMessage.programName) != 0)
it->second.procName = parsedMessage.programName;
}
}
else if( it != clients.end() )

View File

@ -651,7 +651,7 @@ void IpAddress::Set( const struct sockaddr& addr )
#else
auto ai = (const struct sockaddr_in*)&addr;
#endif
inet_ntop( AF_INET, &ai->sin_addr, m_text, TEXT_SIZE );
inet_ntop(AF_INET, &ai->sin_addr, m_text, TEXT_SIZE);
m_number = ai->sin_addr.s_addr;
}

View File

@ -104,4 +104,4 @@ uint64_t ClientUniqueID(tracy::IpAddress const& addr, uint16_t port)
{
return uint64_t(addr.GetNumber()) | (uint64_t(port) << 32);
}
}
} // namespace tracy

View File

@ -12,6 +12,6 @@ namespace tracy
std::optional<tracy::BroadcastMessage> ParseBroadcastMessage(const char* msg, size_t msgLen);
// internal unique ID for a client
uint64_t ClientUniqueID(tracy::IpAddress const& addr, uint16_t port);
}
} // namespace tracy
#endif