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
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue