Skip to content

Commit

Permalink
changes made to make the code work after a rebase from master
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhea committed Dec 3, 2018
1 parent b56026c commit c2b21e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CNAME = p2pc
.PHONY : all java-daemon java-client go-client go-daemon deps gx clean
.DEFAULT_GOAL : go-daemon

all: go-daemon go-client java-daemon java-client
all: deps go-daemon go-client java-daemon java-client

java-daemon: lib$(DNAME).$(EXT)

Expand Down
14 changes: 10 additions & 4 deletions p2pd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (

libp2p "github.com/libp2p/go-libp2p"
connmgr "github.com/libp2p/go-libp2p-connmgr"
p2pd "github.com/libp2p/go-libp2p-daemon"
quic "github.com/libp2p/go-libp2p-quic-transport"
identify "github.com/libp2p/go-libp2p/p2p/protocol/identify"

p2pd "github.com/libp2p/go-libp2p-daemon"
)

// DaemonConfig defines the configuration options
Expand All @@ -30,6 +31,8 @@ type DaemonConfig struct {
connMgrLo *int
connMgrHi *int
connMgrGrace *int
QUIC *bool
natPortMap *bool
args []string
}

Expand All @@ -52,6 +55,8 @@ func initialize() DaemonConfig {
connMgrLo: flag.Int("connLo", 256, "Connection Manager Low Water mark"),
connMgrHi: flag.Int("connHi", 512, "Connection Manager High Water mark"),
connMgrGrace: flag.Int("connGrace", 120, "Connection Manager grace period (in seconds)"),
QUIC: flag.Bool("quic", false, "Enables the QUIC transport"),
natPortMap: flag.Bool("natPortMap", false, "Enables NAT port mapping"),
}
flag.Parse()
config.args = flag.Args()
Expand Down Expand Up @@ -82,7 +87,7 @@ func start(config DaemonConfig) {
opts = append(opts, libp2p.ConnectionManager(cm))
}

if *QUIC {
if *config.QUIC {
opts = append(opts,
libp2p.DefaultTransports,
libp2p.Transport(quic.NewTransport),
Expand All @@ -94,11 +99,12 @@ func start(config DaemonConfig) {
))
}

if *natPortMap {
if *config.natPortMap {
opts = append(opts, libp2p.NATPortMap())
}

d, err := p2pd.NewDaemon(context.Background(), *sock, opts...)
d, err := p2pd.NewDaemon(context.Background(), *config.sock, opts...)

if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit c2b21e2

Please sign in to comment.