From 93826ae522f6c15eec86d235e11bcec413ceb4f6 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 13 Nov 2022 00:32:12 +0100 Subject: [PATCH] packages/hyprspace: use some ConnManager features --- packages/networking/hyprspace/cli/up.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/networking/hyprspace/cli/up.go b/packages/networking/hyprspace/cli/up.go index 4673473..c485458 100644 --- a/packages/networking/hyprspace/cli/up.go +++ b/packages/networking/hyprspace/cli/up.go @@ -144,6 +144,12 @@ func UpRun(r *cmd.Root, c *cmd.Sub) { ) checkErr(err) + for _, id := range cfg.Peers { + p, err := peer.Decode(id.ID) + checkErr(err) + host.ConnManager().Protect(p, "/hyprspace/peer") + } + // Setup Peer Table for Quick Packet --> Dest ID lookup peerTable := make(map[string]peer.ID) for ip, id := range cfg.Peers { @@ -270,6 +276,7 @@ func signalHandler(host host.Host, lockPath string, dht *dht.IpfsDHT) { select { case <-rebootstrapCh: fmt.Println("[-] Rebootstrapping on SIGUSR1") + host.ConnManager().TrimOpenConns(context.Background()) <-dht.ForceRefresh() p2p.Rediscover() case <-exitCh: