Show warning if calculated and received caps hash are different.
This commit is contained in:
parent
306519f6e9
commit
54ad65c744
2 changed files with 7 additions and 3 deletions
|
@ -251,7 +251,8 @@ class NullClientCaps(AbstractClientCaps):
|
||||||
def _lookup_in_cache(self, caps_cache):
|
def _lookup_in_cache(self, caps_cache):
|
||||||
# lookup something which does not exist to get a new CacheItem created
|
# lookup something which does not exist to get a new CacheItem created
|
||||||
cache_item = caps_cache[('dummy', '')]
|
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
|
return cache_item
|
||||||
|
|
||||||
def _discover(self, connection, jid):
|
def _discover(self, connection, jid):
|
||||||
|
|
|
@ -90,6 +90,8 @@ class ConnectionCaps(object):
|
||||||
cache_item = lookup(self._capscache)
|
cache_item = lookup(self._capscache)
|
||||||
|
|
||||||
if cache_item.is_valid():
|
if cache_item.is_valid():
|
||||||
|
# we already know that the hash is fine and have already cached
|
||||||
|
# the identities and features
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
validate = contact.client_caps.get_hash_validation_strategy()
|
validate = contact.client_caps.get_hash_validation_strategy()
|
||||||
|
@ -101,8 +103,9 @@ class ConnectionCaps(object):
|
||||||
node = caps_hash = hash_method = None
|
node = caps_hash = hash_method = None
|
||||||
contact.client_caps = self._create_suitable_client_caps(node,
|
contact.client_caps = self._create_suitable_client_caps(node,
|
||||||
caps_hash, hash_method)
|
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,))
|
self._dispatch_event('CAPS_RECEIVED', (jid,))
|
||||||
|
|
||||||
|
|
||||||
# vim: se ts=3:
|
# vim: se ts=3:
|
||||||
|
|
Loading…
Add table
Reference in a new issue