mirror of https://github.com/zlatinb/muwire
Make connection manager listen to trust events
parent
d708939f61
commit
6ddce7d276
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue