From d708939f617e7c49f6de1e2cd7138395ad4defe6 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sat, 21 Jul 2018 22:21:39 +0100 Subject: [PATCH] connection manager type hierarchy --- .../core/connection/ConnectionManager.groovy | 13 +++++++++++++ .../core/connection/LeafConnectionManager.groovy | 14 ++++++++++++++ .../connection/UltrapeerConnectionManager.groovy | 15 +++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 core/src/main/groovy/com/muwire/core/connection/ConnectionManager.groovy create mode 100644 core/src/main/groovy/com/muwire/core/connection/LeafConnectionManager.groovy create mode 100644 core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy diff --git a/core/src/main/groovy/com/muwire/core/connection/ConnectionManager.groovy b/core/src/main/groovy/com/muwire/core/connection/ConnectionManager.groovy new file mode 100644 index 00000000..a9baace6 --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/connection/ConnectionManager.groovy @@ -0,0 +1,13 @@ +package com.muwire.core.connection + +import com.muwire.core.EventBus + +abstract class ConnectionManager { + + final EventBus eventBus + + ConnectionManager(EventBus eventBus) { + this.eventBus = eventBus + } + +} diff --git a/core/src/main/groovy/com/muwire/core/connection/LeafConnectionManager.groovy b/core/src/main/groovy/com/muwire/core/connection/LeafConnectionManager.groovy new file mode 100644 index 00000000..1e12a0a1 --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/connection/LeafConnectionManager.groovy @@ -0,0 +1,14 @@ +package com.muwire.core.connection + +import com.muwire.core.EventBus + +class LeafConnectionManager extends ConnectionManager { + + final int maxConnections + + public LeafConnectionManager(EventBus eventBus, int maxConnections) { + super(eventBus) + this.maxConnections = maxConnections + } + +} diff --git a/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy new file mode 100644 index 00000000..869069f4 --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/connection/UltrapeerConnectionManager.groovy @@ -0,0 +1,15 @@ +package com.muwire.core.connection + +import com.muwire.core.EventBus + +class UltrapeerConnectionManager extends ConnectionManager { + + final int maxPeers, maxLeafs + + public UltrapeerConnectionManager(EventBus eventBus, int maxPeers, int maxLeafs) { + super(eventBus) + this.maxPeers = maxPeers + this.maxLeafs = maxLeafs + } + +}