Skip to content

Commit 9db295b

Browse files
committed
[MRP] Update GetAckTimeout to take into account the PeerActive status and use GetRetransmissionTimeout to be more accurate
1 parent 7066ac5 commit 9db295b

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/controller/python/test/test_scripts/network_commissioning.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ async def test_wifi(self, endpointId):
198198
logger.info(f"Connect to a network")
199199
req = Clusters.NetworkCommissioning.Commands.ConnectNetwork(
200200
networkID=TEST_WIFI_SSID.encode(), breadcrumb=self.with_breadcrumb())
201-
res = await self._devCtrl.SendCommand(nodeid=self._nodeid, endpoint=endpointId, payload=req)
201+
res = await self._devCtrl.SendCommand(nodeid=self._nodeid, endpoint=endpointId, payload=req, interactionTimeoutMs=120000)
202202
logger.info(f"Got response: {res}")
203203
if res.networkingStatus != Clusters.NetworkCommissioning.Enums.NetworkCommissioningStatus.kSuccess:
204204
raise AssertionError(f"Unexpected result: {res.networkingStatus}")
@@ -332,7 +332,7 @@ async def test_thread(self, endpointId):
332332
logger.info(f"Connect to a network")
333333
req = Clusters.NetworkCommissioning.Commands.ConnectNetwork(
334334
networkID=TEST_THREAD_NETWORK_IDS[0], breadcrumb=self.with_breadcrumb())
335-
res = await self._devCtrl.SendCommand(nodeid=self._nodeid, endpoint=endpointId, payload=req)
335+
res = await self._devCtrl.SendCommand(nodeid=self._nodeid, endpoint=endpointId, payload=req, interactionTimeoutMs=120000)
336336
logger.info(f"Got response: {res}")
337337
if res.networkingStatus != Clusters.NetworkCommissioning.Enums.NetworkCommissioningStatus.kSuccess:
338338
raise AssertionError(f"Unexpected result: {res.networkingStatus}")

src/transport/SecureSession.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ class SecureSession : public Session, public ReferenceCounted<SecureSession, Sec
162162
switch (mPeerAddress.GetTransportType())
163163
{
164164
case Transport::Type::kUdp:
165-
return GetRemoteMRPConfig().mIdleRetransTimeout * (CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS + 1);
165+
return GetRetransmissionTimeout(mRemoteMRPConfig.mActiveRetransTimeout, mRemoteMRPConfig.mIdleRetransTimeout,
166+
GetLastPeerActivityTime());
166167
case Transport::Type::kTcp:
167168
return System::Clock::Seconds16(30);
168169
case Transport::Type::kBle:
@@ -222,7 +223,8 @@ class SecureSession : public Session, public ReferenceCounted<SecureSession, Sec
222223

223224
bool IsPeerActive() const
224225
{
225-
return ((System::SystemClock().GetMonotonicTimestamp() - GetLastPeerActivityTime()) < kMinActiveTime);
226+
return ((System::SystemClock().GetMonotonicTimestamp() - GetLastPeerActivityTime()) <
227+
GetRetransmissionTimeout(mRemoteMRPConfig.mActiveRetransTimeout));
226228
}
227229

228230
System::Clock::Timestamp GetMRPBaseTimeout() const override

src/transport/Session.h

-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ class UnauthenticatedSession;
157157
class IncomingGroupSession;
158158
class OutgoingGroupSession;
159159

160-
constexpr System::Clock::Milliseconds32 kMinActiveTime = System::Clock::Milliseconds32(4000);
161-
162160
class Session
163161
{
164162
public:

src/transport/UnauthenticatedSessionTable.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ class UnauthenticatedSession : public Session,
8787
switch (mPeerAddress.GetTransportType())
8888
{
8989
case Transport::Type::kUdp:
90-
return GetRemoteMRPConfig().mIdleRetransTimeout * (CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS + 1);
90+
return GetRetransmissionTimeout(mRemoteMRPConfig.mActiveRetransTimeout, mRemoteMRPConfig.mIdleRetransTimeout,
91+
GetLastPeerActivityTime());
9192
case Transport::Type::kTcp:
9293
return System::Clock::Seconds16(30);
9394
default:
@@ -113,7 +114,8 @@ class UnauthenticatedSession : public Session,
113114

114115
bool IsPeerActive() const
115116
{
116-
return ((System::SystemClock().GetMonotonicTimestamp() - GetLastPeerActivityTime()) < kMinActiveTime);
117+
return ((System::SystemClock().GetMonotonicTimestamp() - GetLastPeerActivityTime()) <
118+
GetRetransmissionTimeout(mRemoteMRPConfig.mActiveRetransTimeout));
117119
}
118120

119121
System::Clock::Timestamp GetMRPBaseTimeout() const override

0 commit comments

Comments
 (0)