Show warning if calculated and received caps hash are different.

This commit is contained in:
Stephan Erb 2009-12-27 16:23:31 +01:00
parent 306519f6e9
commit 54ad65c744
2 changed files with 7 additions and 3 deletions

View File

@ -251,7 +251,8 @@ class NullClientCaps(AbstractClientCaps):
def _lookup_in_cache(self, caps_cache):
# lookup something which does not exist to get a new CacheItem created
cache_item = caps_cache[('dummy', '')]
assert cache_item.status != CACHED
# Mark the item as cached so that protocol/caps.py does not update it
cache_item.status = CACHED
return cache_item
def _discover(self, connection, jid):
@ -390,4 +391,4 @@ class CapsCache(object):
else:
q.update_last_seen()
# vim: se ts=3:
# vim: se ts=3:

View File

@ -90,6 +90,8 @@ class ConnectionCaps(object):
cache_item = lookup(self._capscache)
if cache_item.is_valid():
# we already know that the hash is fine and have already cached
# the identities and features
return
else:
validate = contact.client_caps.get_hash_validation_strategy()
@ -101,8 +103,9 @@ class ConnectionCaps(object):
node = caps_hash = hash_method = None
contact.client_caps = self._create_suitable_client_caps(node,
caps_hash, hash_method)
log.warn("Computed and retrieved caps hash differ." +
"Ignoring caps of contact %s" % contact.get_full_jid())
self._dispatch_event('CAPS_RECEIVED', (jid,))
# vim: se ts=3: