mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-07-23 16:28:12 -07:00
Consistency
This commit is contained in:
+6
-8
@@ -127,11 +127,10 @@ class Identity:
|
|||||||
:returns: An :ref:`RNS.Identity<api-identity>` instance that can be used to create an outgoing :ref:`RNS.Destination<api-destination>`, or *None* if the destination is unknown.
|
:returns: An :ref:`RNS.Identity<api-identity>` instance that can be used to create an outgoing :ref:`RNS.Destination<api-destination>`, or *None* if the destination is unknown.
|
||||||
"""
|
"""
|
||||||
if from_identity_hash:
|
if from_identity_hash:
|
||||||
with Identity.known_destinations_lock:
|
with Identity.known_destinations_lock: destination_hashes = list(Identity.known_destinations.keys())
|
||||||
destination_hashes = list(Identity.known_destinations.keys())
|
|
||||||
for destination_hash in destination_hashes:
|
for destination_hash in destination_hashes:
|
||||||
entry = Identity.known_destinations.get(destination_hash)
|
entry = Identity.known_destinations.get(destination_hash)
|
||||||
if entry is None: continue
|
if not entry: continue
|
||||||
if target_hash == Identity.truncated_hash(entry[2]):
|
if target_hash == Identity.truncated_hash(entry[2]):
|
||||||
if not _no_use: RNS.Reticulum.get_instance()._used_destination_data(destination_hash)
|
if not _no_use: RNS.Reticulum.get_instance()._used_destination_data(destination_hash)
|
||||||
identity = Identity(create_keys=False)
|
identity = Identity(create_keys=False)
|
||||||
@@ -297,11 +296,10 @@ class Identity:
|
|||||||
def _retain_identity(identity_hash):
|
def _retain_identity(identity_hash):
|
||||||
try:
|
try:
|
||||||
retained = False
|
retained = False
|
||||||
with Identity.known_destinations_lock:
|
with Identity.known_destinations_lock: destination_hashes = list(Identity.known_destinations.keys())
|
||||||
destination_hashes = list(Identity.known_destinations.keys())
|
|
||||||
for destination_hash in destination_hashes:
|
for destination_hash in destination_hashes:
|
||||||
entry = Identity.known_destinations.get(destination_hash)
|
entry = Identity.known_destinations.get(destination_hash)
|
||||||
if entry is None: continue
|
if not entry: continue
|
||||||
if identity_hash == Identity.truncated_hash(entry[2]):
|
if identity_hash == Identity.truncated_hash(entry[2]):
|
||||||
if Identity._retain_destination_data(destination_hash): retained = True
|
if Identity._retain_destination_data(destination_hash): retained = True
|
||||||
|
|
||||||
@@ -318,8 +316,8 @@ class Identity:
|
|||||||
no_path = 0
|
no_path = 0
|
||||||
retained = 0
|
retained = 0
|
||||||
never_used = 0
|
never_used = 0
|
||||||
with Identity.known_destinations_lock:
|
|
||||||
destination_hashes = list(Identity.known_destinations.keys())
|
with Identity.known_destinations_lock: destination_hashes = list(Identity.known_destinations.keys())
|
||||||
for destination_hash in destination_hashes:
|
for destination_hash in destination_hashes:
|
||||||
try:
|
try:
|
||||||
if RNS.Transport.has_path(destination_hash): has_path = True
|
if RNS.Transport.has_path(destination_hash): has_path = True
|
||||||
|
|||||||
Reference in New Issue
Block a user