Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
27d0e692
Commit
27d0e692
authored
Sep 16, 2014
by
Juan Batiz-Benet
Committed by
Brian Tiger Chow
Sep 22, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core dht setup
parent
865109f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
core/core.go
core/core.go
+13
-3
No files found.
core/core.go
View file @
27d0e692
...
...
@@ -17,6 +17,7 @@ import (
merkledag
"github.com/jbenet/go-ipfs/merkledag"
inet
"github.com/jbenet/go-ipfs/net"
mux
"github.com/jbenet/go-ipfs/net/mux"
netservice
"github.com/jbenet/go-ipfs/net/service"
path
"github.com/jbenet/go-ipfs/path"
peer
"github.com/jbenet/go-ipfs/peer"
routing
"github.com/jbenet/go-ipfs/routing"
...
...
@@ -85,15 +86,24 @@ func NewIpfsNode(cfg *config.Config, online bool) (*IpfsNode, error) {
if
online
{
// add protocol services here.
ctx
:=
context
.
TODO
()
// derive this from a higher context.
dhts
:=
netservice
.
Service
(
nil
)
// nil handler for now, need to patch it
if
err
:=
dhts
.
Start
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
net
,
err
:=
inet
.
NewIpfsNetwork
(
context
.
TODO
(),
local
,
&
mux
.
ProtocolMap
{
// "1"
: dhtService,
//
"2"
: bitswapService,
netservice
.
ProtocolID_Routing
:
dhtService
,
//
netservice.ProtocolID_Bitswap
: bitswapService,
})
if
err
!=
nil
{
return
nil
,
err
}
route
=
dht
.
NewDHT
(
local
,
net
,
d
)
route
=
dht
.
NewDHT
(
local
,
net
,
dhts
,
d
)
dhts
.
Handler
=
route
// wire the handler to the service.
// TODO(brian): pass a context to DHT for its async operations
route
.
Start
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment