Skip to content

Commit ae69eb9

Browse files
Log message send failures.
We're not actually clearly logging when messages fail to send (e.g. due to no route to host). We should be.
1 parent 04251f1 commit ae69eb9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/transport/SessionManager.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,14 @@ CHIP_ERROR SessionManager::SendPreparedMessage(const SessionHandle & sessionHand
446446

447447
if (mTransportMgr != nullptr)
448448
{
449-
return mTransportMgr->SendMessage(*destination, std::move(msgBuf));
449+
CHIP_ERROR err = mTransportMgr->SendMessage(*destination, std::move(msgBuf));
450+
#if CHIP_ERROR_LOGGING
451+
char addressStr[Transport::PeerAddress::kMaxToStringSize] = { 0 };
452+
destination->ToString(addressStr);
453+
454+
ChipLogError(Inet, "SendMessage() to %s failed: %" CHIP_ERROR_FORMAT, addressStr, err.Format());
455+
#endif // CHIP_ERROR_LOGGING
456+
return err;
450457
}
451458

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

0 commit comments

Comments
 (0)