Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Libraries/Opc.Ua.Client/Session/ISession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public interface ISession : ISessionClient
/// Returns true if the session is not receiving keep alives.
/// </summary>
/// <remarks>
/// Set to true if the server does not respond for 2 times the KeepAliveInterval.
/// Set to true if the server does not respond for the KeepAliveInterval times a configurable factor + a configurable guard band.
/// Set to false is communication recovers.
/// </remarks>
bool KeepAliveStopped { get; }
Expand Down
16 changes: 13 additions & 3 deletions Libraries/Opc.Ua.Client/Session/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public partial class Session : SessionClientBatched, ISession
private const int kMinPublishRequestCountMax = 100;
private const int kMaxPublishRequestCountMax = ushort.MaxValue;
private const int kDefaultPublishRequestCount = 1;
private const int kKeepAliveGuardBand = 1000;
private const int kPublishRequestSequenceNumberOutOfOrderThreshold = 10;
private const int kPublishRequestSequenceNumberOutdatedThreshold = 100;

Expand Down Expand Up @@ -705,7 +704,8 @@ public int KeepAliveInterval
/// Returns true if the session is not receiving keep alives.
/// </summary>
/// <remarks>
/// Set to true if the server does not respond for 2 times the KeepAliveInterval
/// Set to true if the server does not respond for the KeepAliveInterval * 1 (KeepaliveIntervalFactor) + 1 Second (KeepAliveGuardBand) *
/// To change the senstivity of the keep alive check, set the <see cref="m_keepAliveIntervalFactor"/> / <see cref="m_keepAliveGuardBand"/> fields.
/// or if another error was reported.
/// Set to false is communication is ok or recovered.
/// </remarks>
Expand All @@ -719,7 +719,7 @@ public bool KeepAliveStopped
int delta = HiResClock.TickCount - m_lastKeepAliveTickCount;

// add a guard band to allow for network lag.
return (m_keepAliveInterval + kKeepAliveGuardBand) <= delta;
return (m_keepAliveInterval * m_keepAliveIntervalFactor + m_keepAliveGuardBand) <= delta;
}

// another error was reported which caused keep alive to stop.
Expand Down Expand Up @@ -6648,6 +6648,16 @@ protected virtual void ProcessResponseAdditionalHeader(ResponseHeader responseHe
/// The user identity currently used for the session.
/// </summary>
protected IUserIdentity m_identity;

/// <summary>
/// Factor appiled to the <see cref="m_keepAliveInterval"/> before <see cref="KeepAliveStopped"/> is set to true
/// </summary>
protected int m_keepAliveIntervalFactor = 1;

/// <summary>
/// Time in milliseconds added to <see cref="m_keepAliveInterval"/> before <see cref="KeepAliveStopped"/> is set to true
/// </summary>
protected int m_keepAliveGuardBand = 1000;
#endregion

#region Private Fields
Expand Down
Loading