Skip to content

Commit

Permalink
Make GetMRPBaseTimeout method const (#23300)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple authored Oct 22, 2022
1 parent e32aadb commit f5dfb4d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/transport/GroupSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class IncomingGroupSession : public Session, public ReferenceCounted<IncomingGro
return cfg;
}

System::Clock::Timestamp GetMRPBaseTimeout() override { return System::Clock::kZero; }
System::Clock::Timestamp GetMRPBaseTimeout() const override { return System::Clock::kZero; }

System::Clock::Milliseconds32 GetAckTimeout() const override
{
Expand Down Expand Up @@ -117,7 +117,7 @@ class OutgoingGroupSession : public Session, public ReferenceCounted<OutgoingGro
return cfg;
}

System::Clock::Timestamp GetMRPBaseTimeout() override { return System::Clock::kZero; }
System::Clock::Timestamp GetMRPBaseTimeout() const override { return System::Clock::kZero; }

System::Clock::Milliseconds32 GetAckTimeout() const override
{
Expand Down
7 changes: 5 additions & 2 deletions src/transport/SecureSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,12 @@ class SecureSession : public Session, public ReferenceCounted<SecureSession, Sec
}
}

bool IsPeerActive() { return ((System::SystemClock().GetMonotonicTimestamp() - GetLastPeerActivityTime()) < kMinActiveTime); }
bool IsPeerActive() const
{
return ((System::SystemClock().GetMonotonicTimestamp() - GetLastPeerActivityTime()) < kMinActiveTime);
}

System::Clock::Timestamp GetMRPBaseTimeout() override
System::Clock::Timestamp GetMRPBaseTimeout() const override
{
return IsPeerActive() ? GetRemoteMRPConfig().mActiveRetransTimeout : GetRemoteMRPConfig().mIdleRetransTimeout;
}
Expand Down
2 changes: 1 addition & 1 deletion src/transport/Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class Session
virtual Access::SubjectDescriptor GetSubjectDescriptor() const = 0;
virtual bool RequireMRP() const = 0;
virtual const ReliableMessageProtocolConfig & GetRemoteMRPConfig() const = 0;
virtual System::Clock::Timestamp GetMRPBaseTimeout() = 0;
virtual System::Clock::Timestamp GetMRPBaseTimeout() const = 0;
virtual System::Clock::Milliseconds32 GetAckTimeout() const = 0;

// Returns a suggested timeout value based on the round-trip time it takes for the peer at the other end of the session to
Expand Down
7 changes: 5 additions & 2 deletions src/transport/UnauthenticatedSessionTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ class UnauthenticatedSession : public Session,
const PeerAddress & GetPeerAddress() const { return mPeerAddress; }
void SetPeerAddress(const PeerAddress & peerAddress) { mPeerAddress = peerAddress; }

bool IsPeerActive() { return ((System::SystemClock().GetMonotonicTimestamp() - GetLastPeerActivityTime()) < kMinActiveTime); }
bool IsPeerActive() const
{
return ((System::SystemClock().GetMonotonicTimestamp() - GetLastPeerActivityTime()) < kMinActiveTime);
}

System::Clock::Timestamp GetMRPBaseTimeout() override
System::Clock::Timestamp GetMRPBaseTimeout() const override
{
return IsPeerActive() ? GetRemoteMRPConfig().mActiveRetransTimeout : GetRemoteMRPConfig().mIdleRetransTimeout;
}
Expand Down

0 comments on commit f5dfb4d

Please sign in to comment.