Skip to content

Commit 11495f3

Browse files
past-duepull[bot]
authored andcommitted
recvMultiStats: Additional sanity checks & debug output
1 parent 637ef0c commit 11495f3

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/multistat.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@ void recvMultiStats(NETQUEUE queue)
265265
{
266266
playerStats[playerIndex].identity.fromBytes(identity, EcKey::Public);
267267
}
268-
if (identity != prevIdentity)
268+
else
269+
{
270+
debug(LOG_INFO, "Player sent empty identity: (player: %u, name: \"%s\", IP: %s)", playerIndex, NetPlay.players[playerIndex].name, NetPlay.players[playerIndex].IPtextAddress);
271+
}
272+
if ((identity != prevIdentity) || identity.empty())
269273
{
270274
ingame.PingTimes[playerIndex] = PING_LIMIT;
271275
ingame.VerifiedIdentity[playerIndex] = false;
@@ -281,9 +285,16 @@ void recvMultiStats(NETQUEUE queue)
281285
}
282286

283287
// Output to stdinterface, if enabled
284-
std::string senderPublicKeyB64 = base64Encode(playerStats[playerIndex].identity.toBytes(EcKey::Public));
285-
std::string senderIdentityHash = playerStats[playerIndex].identity.publicHashString();
286-
wz_command_interface_output("WZEVENT: player identity UNVERIFIED: %" PRIu32 " %s %s\n", playerIndex, senderPublicKeyB64.c_str(), senderIdentityHash.c_str());
288+
if (!identity.empty())
289+
{
290+
std::string senderPublicKeyB64 = base64Encode(playerStats[playerIndex].identity.toBytes(EcKey::Public));
291+
std::string senderIdentityHash = playerStats[playerIndex].identity.publicHashString();
292+
wz_command_interface_output("WZEVENT: player identity UNVERIFIED: %" PRIu32 " %s %s\n", playerIndex, senderPublicKeyB64.c_str(), senderIdentityHash.c_str());
293+
}
294+
else
295+
{
296+
wz_command_interface_output("WZEVENT: player identity EMPTY: %" PRIu32 "\n", playerIndex);
297+
}
287298

288299
processAutoratingData = true;
289300
}

0 commit comments

Comments
 (0)