X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fwot%2FIdentityManagerImpl.kt;h=5f087c7eb899555fee35ffafd0d53f31d83140cc;hb=a6aaf80dbee1c4b6e70159bf6b3c26609d8c3974;hp=1e83cd7cf76582d7d677405edaf0756c478a06c7;hpb=631486ae748d8ba85068688685da13df746feafa;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt b/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt index 1e83cd7..5f087c7 100644 --- a/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt +++ b/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt @@ -1,5 +1,5 @@ /* - * Sone - IdentityManagerImpl.java - Copyright © 2010–2019 David Roden + * Sone - IdentityManagerImpl.kt - Copyright © 2010–2020 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,6 +58,13 @@ class IdentityManagerImpl @Inject constructor( try { val currentIdentities = identityLoader.loadIdentities() + val onlyTrustedByAll = currentIdentities.mapValues { (ownIdentity, trustedIdentities) -> + trustedIdentities.filter { trustedIdentity -> + currentIdentities.all { trustedIdentity in it.value } + } + } + logger.log(Level.FINE, "Reduced (${currentIdentities.size},(${currentIdentities.values.joinToString { it.size.toString() }})) identities to (${onlyTrustedByAll.size},(${onlyTrustedByAll.values.joinToString { it.size.toString() }})).") + val identityChangeEventSender = IdentityChangeEventSender(eventBus, oldIdentities) identityChangeEventSender.detectChanges(currentIdentities) @@ -69,6 +76,8 @@ class IdentityManagerImpl @Inject constructor( } } catch (wote1: WebOfTrustException) { logger.log(Level.WARNING, "WoT has disappeared!", wote1) + } catch (e: Exception) { + logger.log(Level.SEVERE, "Uncaught exception in IdentityManager thread!", e) } /* wait a minute before checking again. */