コード例 #1
0
ファイル: AdsSession.cs プロジェクト: Pravin044/TwinCat
 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);
 }
コード例 #2
0
ファイル: AdsSession.cs プロジェクト: Pravin044/TwinCat
 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);
 }
コード例 #3
0
 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);
 }