diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-07-06 17:09:02 +0100 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-07-06 17:09:02 +0100 |
commit | 00e0df7c87915c4b073626bffeead879166526a9 (patch) | |
tree | dbfe8cbc6d8a215bc501f264f6ef921ec3d44785 | |
parent | 6c4eabbe92b607433766bd4b5ca27c1dd0b3480e (diff) |
Yggdrasil demo: Add Stop functions
-rw-r--r-- | build/gobind/monolith.go | 7 | ||||
-rw-r--r-- | cmd/dendrite-demo-yggdrasil/yggconn/node.go | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/build/gobind/monolith.go b/build/gobind/monolith.go index b73e47f8..d415143e 100644 --- a/build/gobind/monolith.go +++ b/build/gobind/monolith.go @@ -180,3 +180,10 @@ func (m *DendriteMonolith) Start(staticPeer string, enableMulticast bool) { logger.Fatal(httpServer.Serve(m.listener)) }() } + +func (m *DendriteMonolith) Stop() { + if err := m.listener.Close(); err != nil { + logrus.Warn("Error stopping listener:", err) + } + m.YggdrasilNode.Stop() +} diff --git a/cmd/dendrite-demo-yggdrasil/yggconn/node.go b/cmd/dendrite-demo-yggdrasil/yggconn/node.go index 4b08f1f3..c89b0dc1 100644 --- a/cmd/dendrite-demo-yggdrasil/yggconn/node.go +++ b/cmd/dendrite-demo-yggdrasil/yggconn/node.go @@ -156,6 +156,13 @@ func Setup(instanceName, instancePeer, storageDirectory string, enableMulticast return n, nil } +func (n *Node) Stop() { + if err := n.multicast.Stop(); err != nil { + n.log.Println("Error stopping multicast:", err) + } + n.core.Stop() +} + func (n *Node) DerivedServerName() string { return hex.EncodeToString(n.SigningPublicKey()) } |