Skip to content

Commit 7ccaa37

Browse files
nodiscard ChipError Batch project-chip#9: inet, messaging, system (project-chip#41867)
* Batch project-chip#9 nodiscard errors: inet, messaging, system * Inadvertent change * Update src/messaging/ExchangeMgr.cpp Co-authored-by: Boris Zbarsky <[email protected]> --------- Co-authored-by: Boris Zbarsky <[email protected]>
1 parent ed2e31b commit 7ccaa37

File tree

10 files changed

+37
-31
lines changed

10 files changed

+37
-31
lines changed

src/inet/TCPEndPoint.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void TCPEndPoint::Shutdown()
150150
if (mState == State::kConnected)
151151
{
152152
mState = State::kSendShutdown;
153-
DriveSending();
153+
TEMPORARY_RETURN_IGNORED DriveSending();
154154
}
155155

156156
// Otherwise, if the peer has already closed their end of the connection,
@@ -215,8 +215,8 @@ void TCPEndPoint::SetIdleTimeout(uint32_t timeoutMS)
215215

216216
if (!isIdleTimerRunning && mIdleTimeout)
217217
{
218-
GetSystemLayer().StartTimer(System::Clock::Milliseconds32(INET_TCP_IDLE_CHECK_INTERVAL), HandleIdleTimer,
219-
&GetEndPointManager());
218+
TEMPORARY_RETURN_IGNORED GetSystemLayer().StartTimer(System::Clock::Milliseconds32(INET_TCP_IDLE_CHECK_INTERVAL),
219+
HandleIdleTimer, &GetEndPointManager());
220220
}
221221
}
222222

@@ -246,7 +246,8 @@ void TCPEndPoint::HandleIdleTimer(chip::System::Layer * aSystemLayer, void * aAp
246246

247247
if (lTimerRequired)
248248
{
249-
aSystemLayer->StartTimer(System::Clock::Milliseconds32(INET_TCP_IDLE_CHECK_INTERVAL), HandleIdleTimer, &endPointManager);
249+
TEMPORARY_RETURN_IGNORED aSystemLayer->StartTimer(System::Clock::Milliseconds32(INET_TCP_IDLE_CHECK_INTERVAL),
250+
HandleIdleTimer, &endPointManager);
250251
}
251252
}
252253

@@ -284,7 +285,8 @@ void TCPEndPoint::StartConnectTimerIfSet()
284285
{
285286
if (mConnectTimeoutMsecs > 0)
286287
{
287-
GetSystemLayer().StartTimer(System::Clock::Milliseconds32(mConnectTimeoutMsecs), TCPConnectTimeoutHandler, this);
288+
TEMPORARY_RETURN_IGNORED GetSystemLayer().StartTimer(System::Clock::Milliseconds32(mConnectTimeoutMsecs),
289+
TCPConnectTimeoutHandler, this);
288290
}
289291
}
290292

@@ -337,7 +339,7 @@ void TCPEndPoint::DriveReceiving(const TCPEndPointHandle & handle)
337339
DoClose(err, false);
338340
return;
339341
}
340-
AckReceive(ackLength);
342+
TEMPORARY_RETURN_IGNORED AckReceive(ackLength);
341343
}
342344

343345
// If the connection is closing, and the receive queue is now empty, call DoClose() to complete
@@ -447,7 +449,7 @@ void TCPEndPoint::DoClose(CHIP_ERROR err, bool suppressCallback)
447449

448450
void TCPEndPoint::ScheduleNextTCPUserTimeoutPoll(uint32_t aTimeOut)
449451
{
450-
GetSystemLayer().StartTimer(System::Clock::Milliseconds32(aTimeOut), TCPUserTimeoutHandler, this);
452+
TEMPORARY_RETURN_IGNORED GetSystemLayer().StartTimer(System::Clock::Milliseconds32(aTimeOut), TCPUserTimeoutHandler, this);
451453
}
452454

453455
void TCPEndPoint::StartTCPUserTimeoutTimer()

src/inet/TCPEndPointImplSockets.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ void TCPEndPointImplSockets::DoCloseImpl(CHIP_ERROR err, State oldState)
618618
}
619619
}
620620

621-
static_cast<System::LayerSockets &>(GetSystemLayer()).StopWatchingSocket(&mWatch);
621+
TEMPORARY_RETURN_IGNORED static_cast<System::LayerSockets &>(GetSystemLayer()).StopWatchingSocket(&mWatch);
622622
close(mSocket);
623623
mSocket = kInvalidSocketFd;
624624
}
@@ -741,8 +741,9 @@ CHIP_ERROR TCPEndPointImplSockets::GetSocket(IPAddressType addrType)
741741
mSocket = kInvalidSocketFd;
742742
});
743743
ReturnErrorOnFailure(static_cast<System::LayerSockets &>(GetSystemLayer()).StartWatchingSocket(mSocket, &mWatch));
744-
auto watchCleanup = ScopeExit([&]() { static_cast<System::LayerSockets &>(GetSystemLayer()).StopWatchingSocket(&mWatch); });
745-
mAddrType = addrType;
744+
auto watchCleanup = ScopeExit(
745+
[&]() { TEMPORARY_RETURN_IGNORED static_cast<System::LayerSockets &>(GetSystemLayer()).StopWatchingSocket(&mWatch); });
746+
mAddrType = addrType;
746747

747748
// If creating an IPv6 socket, tell the kernel that it will be IPv6 only. This makes it
748749
// posible to bind two sockets to the same port, one for IPv4 and one for IPv6.
@@ -834,7 +835,7 @@ void TCPEndPointImplSockets::HandlePendingIO(System::SocketEvents events)
834835
// writing, drive outbound data into the connection.
835836
if (IsConnected() && !mSendQueue.IsNull() && events.Has(System::SocketEventFlags::kWrite))
836837
{
837-
DriveSending();
838+
TEMPORARY_RETURN_IGNORED DriveSending();
838839
}
839840

840841
// If in a state were receiving is allowed, and the app is ready to receive data, and data is ready

src/inet/UDPEndPointImplSockets.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ void UDPEndPointImplSockets::CloseImpl()
430430
{
431431
if (mSocket != kInvalidSocketFd)
432432
{
433-
static_cast<System::LayerSockets *>(&GetSystemLayer())->StopWatchingSocket(&mWatch);
433+
TEMPORARY_RETURN_IGNORED static_cast<System::LayerSockets *>(&GetSystemLayer())->StopWatchingSocket(&mWatch);
434434
close(mSocket);
435435
mSocket = kInvalidSocketFd;
436436
}
@@ -848,7 +848,7 @@ CHIP_ERROR UDPEndPointImplSockets::IPv6JoinLeaveMulticastGroupImpl(InterfaceId a
848848
interfaceFound = true;
849849

850850
char ifName[InterfaceId::kMaxIfNameLength];
851-
interfaceIt.GetInterfaceName(ifName, sizeof(ifName));
851+
TEMPORARY_RETURN_IGNORED interfaceIt.GetInterfaceName(ifName, sizeof(ifName));
852852

853853
// Ignore errors here, except for logging, because we expect some of
854854
// these interfaces to not work, and some (e.g. loopback) to always

src/inet/tests/inet-layer-test-tool.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,12 @@ void HandleTCPConnectionComplete(const TCPEndPointHandle & aEndPoint, CHIP_ERROR
526526
printf("TCP connection established to %s:%u\n", lPeerAddressBuffer, lPeerPort);
527527

528528
if (sTCPIPEndPoint->PendingReceiveLength() == 0)
529-
sTCPIPEndPoint->SetReceivedDataForTesting(nullptr);
529+
TEMPORARY_RETURN_IGNORED sTCPIPEndPoint->SetReceivedDataForTesting(nullptr);
530530

531-
sTCPIPEndPoint->DisableReceive();
532-
sTCPIPEndPoint->EnableKeepAlive(10, 100);
533-
sTCPIPEndPoint->DisableKeepAlive();
534-
sTCPIPEndPoint->EnableReceive();
531+
TEMPORARY_RETURN_IGNORED sTCPIPEndPoint->DisableReceive();
532+
TEMPORARY_RETURN_IGNORED sTCPIPEndPoint->EnableKeepAlive(10, 100);
533+
TEMPORARY_RETURN_IGNORED sTCPIPEndPoint->DisableKeepAlive();
534+
TEMPORARY_RETURN_IGNORED sTCPIPEndPoint->EnableReceive();
535535

536536
DriveSend();
537537
}
@@ -541,7 +541,8 @@ void HandleTCPConnectionComplete(const TCPEndPointHandle & aEndPoint, CHIP_ERROR
541541

542542
gSendIntervalExpired = false;
543543
gSystemLayer.CancelTimer(Common::HandleSendTimerComplete, nullptr);
544-
gSystemLayer.StartTimer(System::Clock::Milliseconds32(gSendIntervalMs), Common::HandleSendTimerComplete, nullptr);
544+
TEMPORARY_RETURN_IGNORED gSystemLayer.StartTimer(System::Clock::Milliseconds32(gSendIntervalMs),
545+
Common::HandleSendTimerComplete, nullptr);
545546

546547
SetStatusFailed(sTestState.mStatus);
547548
}
@@ -767,7 +768,8 @@ void DriveSend()
767768
else
768769
{
769770
gSendIntervalExpired = false;
770-
gSystemLayer.StartTimer(System::Clock::Milliseconds32(gSendIntervalMs), Common::HandleSendTimerComplete, nullptr);
771+
TEMPORARY_RETURN_IGNORED gSystemLayer.StartTimer(System::Clock::Milliseconds32(gSendIntervalMs),
772+
Common::HandleSendTimerComplete, nullptr);
771773

772774
if (sTestState.mStats.mTransmit.mActual < sTestState.mStats.mTransmit.mExpected)
773775
{

src/messaging/ExchangeContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void ExchangeContext::DoClose(bool clearRetransTable)
234234
// it is done with the exchange context and the message layer sets all callbacks to NULL and does not send anything
235235
// received on the exchange context up to higher layers. At this point, the message layer needs to handle the
236236
// remaining work to be done on that exchange, (e.g. send all pending acks) before truly cleaning it up.
237-
FlushAcks();
237+
TEMPORARY_RETURN_IGNORED FlushAcks();
238238

239239
// In case the protocol wants a harder release of the EC right away, such as calling Abort(), exchange
240240
// needs to clear the MRP retransmission table immediately.
@@ -542,7 +542,7 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload
542542
if (payloadHeader.NeedsAck())
543543
{
544544
// An acknowledgment needs to be sent back to the peer for this message on this exchange,
545-
HandleNeedsAck(messageCounter, msgFlags);
545+
TEMPORARY_RETURN_IGNORED HandleNeedsAck(messageCounter, msgFlags);
546546
}
547547
}
548548

src/messaging/ExchangeMgr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ void ExchangeManager::OnMessageReceived(const PacketHeader & packetHeader, const
282282
ChipLogValueExchange(ec), ec->GetDelegate());
283283

284284
// Matched ExchangeContext; send to message handler.
285-
ec->HandleMessage(packetHeader.GetMessageCounter(), payloadHeader, msgFlags, std::move(msgBuf));
285+
TEMPORARY_RETURN_IGNORED ec->HandleMessage(packetHeader.GetMessageCounter(), payloadHeader, msgFlags,
286+
std::move(msgBuf));
286287
found = true;
287288
return Loop::Break;
288289
}

src/messaging/ReliableMessageMgr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void ReliableMessageMgr::ExecuteActions()
157157
#if defined(RMP_TICKLESS_DEBUG)
158158
ChipLogDetail(ExchangeManager, "ReliableMessageMgr::ExecuteActions sending ACK %p", rc);
159159
#endif
160-
rc->SendStandaloneAckMessage();
160+
TEMPORARY_RETURN_IGNORED rc->SendStandaloneAckMessage();
161161
}
162162
}
163163
});
@@ -226,7 +226,7 @@ void ReliableMessageMgr::ExecuteActions()
226226
Transport::GetSessionTypeString(session), fabricIndex, ChipLogValueX64(destination));
227227
MATTER_LOG_METRIC(Tracing::kMetricDeviceRMPRetryCount, entry->sendCount);
228228

229-
SendFromRetransTable(entry);
229+
TEMPORARY_RETURN_IGNORED SendFromRetransTable(entry);
230230

231231
return Loop::Continue;
232232
});
@@ -476,7 +476,7 @@ void ReliableMessageMgr::StartTimer()
476476
"ms (in 0x" ChipLogFormatX64 "ms)",
477477
ChipLogValueX64(now.count()), ChipLogValueX64(nextWakeTime.count()), ChipLogValueX64(nextWakeDelay.count()));
478478
#endif
479-
VerifyOrDie(mSystemLayer->StartTimer(nextWakeDelay, Timeout, this) == CHIP_NO_ERROR);
479+
SuccessOrDie(mSystemLayer->StartTimer(nextWakeDelay, Timeout, this));
480480
}
481481
else
482482
{

src/messaging/tests/echo/echo_requester.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ void EchoTimerHandler(chip::System::Layer * systemLayer, void * appState)
123123
if (err != CHIP_NO_ERROR)
124124
{
125125
printf("Send request failed: %s\n", chip::ErrorStr(err));
126-
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
126+
TEMPORARY_RETURN_IGNORED chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
127127
}
128128
}
129129
else
130130
{
131-
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
131+
TEMPORARY_RETURN_IGNORED chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
132132
}
133133
}
134134

@@ -230,7 +230,7 @@ void CloseConnection()
230230

231231
void HandleConnectionAttemptComplete(chip::Transport::ActiveTCPConnectionHandle & conn, CHIP_ERROR err)
232232
{
233-
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
233+
TEMPORARY_RETURN_IGNORED chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
234234

235235
if (err != CHIP_NO_ERROR || conn != gActiveTCPConnState)
236236
{

src/system/TLVPacketBufferBackingStore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class DLL_EXPORT PacketBufferTLVWriter : public chip::TLV::TLVWriter
128128
void Init(chip::System::PacketBufferHandle && buffer, bool useChainedBuffers = false)
129129
{
130130
mBackingStore.Init(std::move(buffer), useChainedBuffers);
131-
chip::TLV::TLVWriter::Init(mBackingStore);
131+
TEMPORARY_RETURN_IGNORED chip::TLV::TLVWriter::Init(mBackingStore);
132132
}
133133
/**
134134
* Finish the writing of a TLV encoding and release ownership of the underlying PacketBuffer.

src/system/WakeEvent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ CHIP_ERROR WakeEvent::Open(LayerSockets & systemLayer)
8888

8989
void WakeEvent::Close(LayerSockets & systemLayer)
9090
{
91-
systemLayer.StopWatchingSocket(&mReadWatch);
91+
TEMPORARY_RETURN_IGNORED systemLayer.StopWatchingSocket(&mReadWatch);
9292
VerifyOrDie(::close(mReadFD) == 0);
9393
VerifyOrDie(::close(mWriteFD) == 0);
9494
mReadFD = -1;

0 commit comments

Comments
 (0)