Skip to content

Commit

Permalink
Treat ENOBUFS as success when doing an MRP send. (#9812)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Sep 27, 2021
1 parent a7af5e4 commit 0568d68
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/messaging/ExchangeMessageDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,20 @@ CHIP_ERROR ExchangeMessageDispatch::SendMessage(SessionHandle session, uint16_t
std::unique_ptr<ReliableMessageMgr::RetransTableEntry, decltype(deleter)> entryOwner(entry, deleter);

ReturnErrorOnFailure(PrepareMessage(session, payloadHeader, std::move(message), entryOwner->retainedBuf));
ReturnErrorOnFailure(SendPreparedMessage(session, entryOwner->retainedBuf));
CHIP_ERROR err = SendPreparedMessage(session, entryOwner->retainedBuf);
if (err == System::MapErrorPOSIX(ENOBUFS))
{
// sendmsg on BSD-based systems never blocks, no matter how the
// socket is configured, and will return ENOBUFS in situation in
// which Linux, for example, blocks.
//
// This is typically a transient situation, so we pretend like this
// packet drop happened somewhere on the network instead of inside
// sendmsg and will just resend it in the normal MRP way later.
ChipLogError(ExchangeManager, "Ignoring ENOBUFS: %" CHIP_ERROR_FORMAT, err.Format());
err = CHIP_NO_ERROR;
}
ReturnErrorOnFailure(err);
reliableMessageMgr->StartRetransmision(entryOwner.release());
}
else
Expand Down

0 comments on commit 0568d68

Please sign in to comment.