Skip to content

Commit

Permalink
Log message send failures. (#32742)
Browse files Browse the repository at this point in the history
We're not actually clearly logging when messages fail to send (e.g. due to no
route to host).  We should be.
  • Loading branch information
bzbarsky-apple authored Mar 27, 2024
1 parent b1f26f8 commit 6a939e9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/transport/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,14 @@ CHIP_ERROR SessionManager::SendPreparedMessage(const SessionHandle & sessionHand

if (mTransportMgr != nullptr)
{
return mTransportMgr->SendMessage(*destination, std::move(msgBuf));
CHIP_ERROR err = mTransportMgr->SendMessage(*destination, std::move(msgBuf));
#if CHIP_ERROR_LOGGING
char addressStr[Transport::PeerAddress::kMaxToStringSize] = { 0 };
destination->ToString(addressStr);

ChipLogError(Inet, "SendMessage() to %s failed: %" CHIP_ERROR_FORMAT, addressStr, err.Format());
#endif // CHIP_ERROR_LOGGING
return err;
}

ChipLogError(Inet, "The transport manager is not initialized. Unable to send the message");
Expand Down

0 comments on commit 6a939e9

Please sign in to comment.