Skip to content

Commit

Permalink
Merge tag '1.0.1' into develop
Browse files Browse the repository at this point in the history
Release 1.0.1

Add mdns discovery and more sane logging output.
info is now a good loglevel.
  • Loading branch information
bahner committed Aug 9, 2023
2 parents 8736953 + 919f8d5 commit 337d70e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dht.go
Expand Up @@ -78,9 +78,9 @@ func discoverDHTPeers(ctx context.Context, h host.Host, rendezvousString string)

err := h.Connect(ctx, peer)
if err != nil {
log.Debugf("Failed connecting to %s, error: %v\n", peer.ID.Pretty(), err)
log.Debugf("Failed connecting to DHT peer %s, error: %v\n", peer.ID.Pretty(), err)
} else {
log.Infof("Connected to: %s", peer.ID.Pretty())
log.Infof("Connected to DHT peer: %s", peer.ID.Pretty())
anyConnected = true
}
}
Expand Down
5 changes: 3 additions & 2 deletions mdns.go
Expand Up @@ -41,15 +41,16 @@ func discoverMDNSPeers(ctx context.Context, h host.Host, rendezvous string) chan
peerChan := initMDNS(h, rendezvous)

for peer := range peerChan {
log.Debugf("Found peer: %s\n", peer.ID.Pretty())
if peer.ID == h.ID() {
continue // Skip self connection
}

err := h.Connect(ctx, peer)
if err != nil {
log.Debugf("Failed connecting to %s, error: %v\n", peer.ID.Pretty(), err)
log.Debugf("Failed connecting to MDNS peer %s, error: %v\n", peer.ID.Pretty(), err)
} else {
log.Infof("Connected to: %s", peer.ID.Pretty())
log.Infof("Connected to MDNS peer: %s", peer.ID.Pretty())
anyConnected = true
}
}
Expand Down

0 comments on commit 337d70e

Please sign in to comment.