Make connection manager listen to trust events

pull/4/head
Zlatin Balevsky 2018-07-22 04:03:05 +01:00
parent d708939f61
commit 6ddce7d276
3 changed files with 25 additions and 0 deletions

View File

@ -1,6 +1,10 @@
package com.muwire.core.connection package com.muwire.core.connection
import com.muwire.core.EventBus 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 { abstract class ConnectionManager {
@ -10,4 +14,10 @@ abstract class ConnectionManager {
this.eventBus = eventBus this.eventBus = eventBus
} }
void onTrustEvent(TrustEvent e) {
if (e.level == TrustLevel.DISTRUSTED)
drop(e.destination)
}
abstract void drop(Destination d);
} }

View File

@ -2,6 +2,8 @@ package com.muwire.core.connection
import com.muwire.core.EventBus import com.muwire.core.EventBus
import net.i2p.data.Destination
class LeafConnectionManager extends ConnectionManager { class LeafConnectionManager extends ConnectionManager {
final int maxConnections final int maxConnections
@ -11,4 +13,10 @@ class LeafConnectionManager extends ConnectionManager {
this.maxConnections = maxConnections this.maxConnections = maxConnections
} }
@Override
public void drop(Destination d) {
// TODO Auto-generated method stub
}
} }

View File

@ -2,6 +2,8 @@ package com.muwire.core.connection
import com.muwire.core.EventBus import com.muwire.core.EventBus
import net.i2p.data.Destination
class UltrapeerConnectionManager extends ConnectionManager { class UltrapeerConnectionManager extends ConnectionManager {
final int maxPeers, maxLeafs final int maxPeers, maxLeafs
@ -11,5 +13,10 @@ class UltrapeerConnectionManager extends ConnectionManager {
this.maxPeers = maxPeers this.maxPeers = maxPeers
this.maxLeafs = maxLeafs this.maxLeafs = maxLeafs
} }
@Override
public void drop(Destination d) {
// TODO Auto-generated method stub
}
} }