diff --git a/core/src/main/groovy/com/muwire/core/connection/ConnectionManager.groovy b/core/src/main/groovy/com/muwire/core/connection/ConnectionManager.groovy index a9baace6..1ba49ace 100644 --- a/core/src/main/groovy/com/muwire/core/connection/ConnectionManager.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/ConnectionManager.groovy @@ -1,6 +1,10 @@ package com.muwire.core.connection import com.muwire.core.EventBus +import com.muwire.core.trust.TrustEvent +import com.muwire.core.trust.TrustLevel + +import net.i2p.data.Destination abstract class ConnectionManager { @@ -10,4 +14,10 @@ abstract class ConnectionManager { this.eventBus = eventBus } + void onTrustEvent(TrustEvent e) { + if (e.level == TrustLevel.DISTRUSTED) + drop(e.destination) + } + + abstract void drop(Destination d); } diff --git a/core/src/main/groovy/com/muwire/core/connection/LeafConnectionManager.groovy b/core/src/main/groovy/com/muwire/core/connection/LeafConnectionManager.groovy index 1e12a0a1..f972dae5 100644 --- a/core/src/main/groovy/com/muwire/core/connection/LeafConnectionManager.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/LeafConnectionManager.groovy @@ -2,6 +2,8 @@ package com.muwire.core.connection import com.muwire.core.EventBus +import net.i2p.data.Destination + class LeafConnectionManager extends ConnectionManager { final int maxConnections @@ -10,5 +12,11 @@ class LeafConnectionManager extends ConnectionManager { super(eventBus) this.maxConnections = maxConnections } + + @Override + public void drop(Destination d) { + // TODO Auto-generated method stub + + } } diff --git a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy index 869069f4..ae33493e 100644 --- a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy @@ -2,6 +2,8 @@ package com.muwire.core.connection import com.muwire.core.EventBus +import net.i2p.data.Destination + class UltrapeerConnectionManager extends ConnectionManager { final int maxPeers, maxLeafs @@ -11,5 +13,10 @@ class UltrapeerConnectionManager extends ConnectionManager { this.maxPeers = maxPeers this.maxLeafs = maxLeafs } + @Override + public void drop(Destination d) { + // TODO Auto-generated method stub + + } }