packages/hyprspace: use some ConnManager features
This commit is contained in:
parent
411143c600
commit
93826ae522
1 changed files with 7 additions and 0 deletions
|
@ -144,6 +144,12 @@ func UpRun(r *cmd.Root, c *cmd.Sub) {
|
||||||
)
|
)
|
||||||
checkErr(err)
|
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
|
// Setup Peer Table for Quick Packet --> Dest ID lookup
|
||||||
peerTable := make(map[string]peer.ID)
|
peerTable := make(map[string]peer.ID)
|
||||||
for ip, id := range cfg.Peers {
|
for ip, id := range cfg.Peers {
|
||||||
|
@ -270,6 +276,7 @@ func signalHandler(host host.Host, lockPath string, dht *dht.IpfsDHT) {
|
||||||
select {
|
select {
|
||||||
case <-rebootstrapCh:
|
case <-rebootstrapCh:
|
||||||
fmt.Println("[-] Rebootstrapping on SIGUSR1")
|
fmt.Println("[-] Rebootstrapping on SIGUSR1")
|
||||||
|
host.ConnManager().TrimOpenConns(context.Background())
|
||||||
<-dht.ForceRefresh()
|
<-dht.ForceRefresh()
|
||||||
p2p.Rediscover()
|
p2p.Rediscover()
|
||||||
case <-exitCh:
|
case <-exitCh:
|
||||||
|
|
Loading…
Reference in a new issue