Skip to content

Commit b79831e

Browse files
Don't stringify PeerAddress in SendPreparedMessage if not logging it. (#32821)
1 parent ff2ab2b commit b79831e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/transport/SessionManager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,10 @@ CHIP_ERROR SessionManager::SendPreparedMessage(const SessionHandle & sessionHand
448448
{
449449
CHIP_ERROR err = mTransportMgr->SendMessage(*destination, std::move(msgBuf));
450450
#if CHIP_ERROR_LOGGING
451-
char addressStr[Transport::PeerAddress::kMaxToStringSize] = { 0 };
452-
destination->ToString(addressStr);
453451
if (err != CHIP_NO_ERROR)
454452
{
453+
char addressStr[Transport::PeerAddress::kMaxToStringSize] = { 0 };
454+
destination->ToString(addressStr);
455455
ChipLogError(Inet, "SendMessage() to %s failed: %" CHIP_ERROR_FORMAT, addressStr, err.Format());
456456
}
457457
#endif // CHIP_ERROR_LOGGING

0 commit comments

Comments
 (0)