protected override void Dispose(bool disposing) { if (disposing) { if (base.connection != null) { ((AdsConnection)base.connection).AmsRouterNotification -= new AmsRouterNotificationEventHandler(this._connection_AmsRouterNotification); } this._failFastHandlerInterceptor = null; this._connectionStateObserver = null; this._interceptor = null; } base.Dispose(disposing); }
ICommunicationInterceptor IInterceptionFactory.CreateInterceptor() { if (this._interceptor == null) { CommunicationInterceptors interceptors = new CommunicationInterceptors(); if (this._settings.ResurrectionTime > TimeSpan.Zero) { this._failFastHandlerInterceptor = new FailFastHandlerInterceptor(this._settings.ResurrectionTime); interceptors.Combine(this._failFastHandlerInterceptor); } this._connectionStateObserver = new ConnectionStateInterceptor(this); interceptors.Combine(this._connectionStateObserver); this._interceptor = interceptors; } return(this._interceptor); }
protected override void OnAfterCommunicate(AdsErrorCode errorCode) { if (FailFastHandlerInterceptor.IsTrippingError(errorCode, this._preventRejectedConnection)) { this.OnError(errorCode); } else { object obj2 = this._synchronizer; lock (obj2) { this._lastSucceeded = DateTime.UtcNow; this._cycleCount++; this._errorCountSinceLastAccess = 0; this._lastAccess = this._lastSucceeded; } this.setState(TwinCAT.ConnectionState.Connected); } base.OnAfterCommunicate(errorCode); }