Logo Search packages:      
Sourcecode: namebench version File versions  Download package

def libnamebench::health_checks::NameServerHealthChecks::TestSharedCache (   self,
  other_ns 
) [inherited]

Is this nameserver sharing a cache with another nameserver?

Args:
  other_ns: A nameserver to compare it to.

Returns:
  A tuple containing:
- Boolean of whether or not this host has a shared cache
- The faster NameServer object
- The slower NameServer object

Definition at line 153 of file health_checks.py.

00153                                      :
    """Is this nameserver sharing a cache with another nameserver?

    Args:
      other_ns: A nameserver to compare it to.

    Returns:
      A tuple containing:
        - Boolean of whether or not this host has a shared cache
        - The faster NameServer object
        - The slower NameServer object
    """
    timeout = self.health_timeout * SHARED_CACHE_TIMEOUT_MULTIPLIER
    checked = []
    shared = False

    if self.disabled or other_ns.disabled:
      return False

    if not other_ns.cache_checks:
      print "%s has no cache checks" % other_ns
      return False

    for (ref_hostname, ref_response, ref_timestamp) in other_ns.cache_checks:
      (response, duration, error_msg) = self.TimedRequest('A', ref_hostname, timeout=timeout)

      if response and response.answer:
        ref_ttl = ref_response.answer[0].ttl
        ttl = response.answer[0].ttl
        delta = abs(ref_ttl - ttl)
        query_age = self.timer() - ref_timestamp
        delta_age_delta = abs(query_age - delta)

        if delta > 0 and delta_age_delta < 2:
          return other_ns
      else:
        sys.stdout.write('x')

      checked.append(ref_hostname)

    if not checked:
      self.AddFailure('Failed to test %s wildcard caches'  % len(other_ns.cache_checks))
    return shared

  def CheckCensorship(self, tests):


Generated by  Doxygen 1.6.0   Back to index