Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Fixed lingering networking issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jalextowle committed Sep 14, 2020
1 parent 6b59ed8 commit 86232c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cmd/mesh-bootstrap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
dht "github.com/libp2p/go-libp2p-kad-dht"
dhtopts "github.com/libp2p/go-libp2p-kad-dht/opts"
"github.com/libp2p/go-libp2p-peerstore/pstoreds"
"github.com/libp2p/go-libp2p-secio"
"github.com/libp2p/go-libp2p/p2p/host/relay"
filter "github.com/libp2p/go-maddr-filter"
ma "github.com/multiformats/go-multiaddr"
Expand Down Expand Up @@ -124,7 +125,7 @@ func main() {
if err != nil {
return nil, err
}
kadDHT, err = dht.New(ctx, h, dhtopts.Datastore(store), dht.V1ProtocolOverride(p2p.DHTProtocolID))
kadDHT, err = dht.New(ctx, h, dhtopts.Datastore(store), dht.V1ProtocolOverride(p2p.DHTProtocolID), dht.Mode(dht.ModeServer))
if err != nil {
log.WithField("error", err).Fatal("could not create DHT")
}
Expand Down Expand Up @@ -168,6 +169,7 @@ func main() {
libp2p.BandwidthReporter(bandwidthCounter),
libp2p.Peerstore(peerStore),
libp2p.Filters(filters),
libp2p.Security(secio.ID, secio.New),
}

if config.EnableRelayHost {
Expand All @@ -184,7 +186,6 @@ func main() {
basicHost.Network().Notify(&notifee{})

// Enable AutoNAT service.
// FIXME - Should this be force enabled?
if _, err := autonat.NewAutoNATService(ctx, basicHost, true); err != nil {
log.WithField("error", err).Fatal("could not enable AutoNAT service")
}
Expand Down
2 changes: 1 addition & 1 deletion p2p/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ func getPublicIP() (string, error) {
// in native (pure Go) environments. Standalone nodes use a SQL key value store
// to persist data and browser nodes use a Dexie key value store.
func NewDHT(ctx context.Context, db *db.DB, host host.Host) (*dht.IpfsDHT, error) {
return dht.New(ctx, host, dhtopts.Datastore(db.DHTStore()), dht.V1ProtocolOverride(DHTProtocolID), dht.Mode(dht.ModeServer))
return dht.New(ctx, host, dhtopts.Datastore(db.DHTStore()), dht.V1ProtocolOverride(DHTProtocolID), dht.Mode(dht.ModeAutoServer))
}

0 comments on commit 86232c2

Please sign in to comment.