コード例 #1
0
ファイル: PeerSecAssociation.cs プロジェクト: hseom/brunet
    ///<summary>This is called when we want to reset the state of the SA after
    ///an equivalent time of two timeouts has occurred.</summary>
    public bool Reset() {
      lock(_sync) {
        DateTime now = DateTime.UtcNow;
        // State is not reset if:
        // - It has been done within the past 120 seconds
        // - This is closed
        // - A packet has been received since the last SA check
        if((_last_update != DateTime.MinValue &&
              _last_update.AddSeconds(120) > now &&
              State != States.Active) ||
            _closed == 1 ||
            (_receiving && State == States.Active))
        {
          return false;
        }
        
        _last_update = DateTime.UtcNow;
        _last_called_request_update = DateTime.UtcNow;

        _local_cert = new WriteOnceX509();
        _remote_cert = new WriteOnceX509();
        DHEWithCertificateAndCAsInHash = new WriteOnceIdempotent<MemBlock>();
        DHEWithCertificateAndCAsOutHash = new WriteOnceIdempotent<MemBlock>();
        DHEWithCertificateHash = new WriteOnceIdempotent<MemBlock>();
        RDHE = new WriteOnceIdempotent<MemBlock>();
        RemoteCookie = new WriteOnceIdempotent<MemBlock>();
        _ldhe = null;
        _hash_verified = false;
        _called_enable = 0;
        _receiving = true;
        _sending = true;
        _just_created = true;
      }

      UpdateState(States.Active, States.Updating);
      return true;
    }
コード例 #2
0
    ///<summary>This is called when we want to reset the state of the SA after
    ///an equivalent time of two timeouts has occurred.</summary>
    public bool Reset() {
      lock(_sync) {
        if(_incoming && _last_update != DateTime.MinValue &&
            (_last_update.AddMilliseconds(TIMEOUT * 2) > DateTime.UtcNow ||
            _closed == 1))
        {
          return false;
        }
        
        _last_update = DateTime.UtcNow;
        _last_called_request_update = DateTime.UtcNow;

        LocalCertificate = new WriteOnceX509();
        RemoteCertificate = new WriteOnceX509();
        DHEWithCertificateAndCAsInHash = new WriteOnceIdempotent<MemBlock>();
        DHEWithCertificateAndCAsOutHash = new WriteOnceIdempotent<MemBlock>();
        DHEWithCertificateHash = new WriteOnceIdempotent<MemBlock>();
        RDHE = new WriteOnceIdempotent<MemBlock>();
        RemoteCookie = new WriteOnceIdempotent<MemBlock>();
        _ldhe = null;
        _hash_verified = false;
        _called_enable = 0;
        _incoming = true;
        _running = true;
      }

      if(State == SAState.Active) {
        State = SAState.Updating;
      }

      return true;
    }
コード例 #3
0
ファイル: PeerSecAssociation.cs プロジェクト: pstjuste/brunet
    public void Reset() {
      lock(_sync) {
        _last_update = DateTime.UtcNow;
        _last_called_request_update = DateTime.UtcNow;

        _local_cert = new WriteOnceX509();
        _remote_cert = new WriteOnceX509();
        DHEWithCertificateAndCAsInHash = new WriteOnceIdempotent<MemBlock>();
        DHEWithCertificateAndCAsOutHash = new WriteOnceIdempotent<MemBlock>();
        DHEWithCertificateHash = new WriteOnceIdempotent<MemBlock>();
        RDHE = new WriteOnceIdempotent<MemBlock>();
        RemoteCookie = new WriteOnceIdempotent<MemBlock>();
        _ldhe = null;
        _hash_verified = false;
        _called_enable = 0;
        _receiving = true;
        _sending = true;
      }

      UpdateState(States.Active, States.Updating);
    }