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
6c419e6a
Commit
6c419e6a
authored
Dec 08, 2014
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style(core) signature
License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
f25893e3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
core/core.go
core/core.go
+9
-3
No files found.
core/core.go
View file @
6c419e6a
...
@@ -179,7 +179,13 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) {
...
@@ -179,7 +179,13 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) {
n
.
Exchange
=
bitswap
.
New
(
ctx
,
n
.
Identity
,
bitswapNetwork
,
n
.
Routing
,
blockstore
,
alwaysSendToPeer
)
n
.
Exchange
=
bitswap
.
New
(
ctx
,
n
.
Identity
,
bitswapNetwork
,
n
.
Routing
,
blockstore
,
alwaysSendToPeer
)
go
initConnections
(
ctx
,
n
.
Config
,
n
.
Peerstore
,
dhtRouting
)
// TODO consider connection supervision into the Network. We've
// discussed improvements to this Node constructor. One improvement
// would be to make the node configurable, allowing clients to inject
// an Exchange, Network, or Routing component and have the constructor
// manage the wiring. In that scenario, this dangling function is a bit
// awkward.
go
initConnections
(
ctx
,
n
.
Config
.
Bootstrap
,
n
.
Peerstore
,
dhtRouting
)
}
}
// TODO(brian): when offline instantiate the BlockService with a bitswap
// TODO(brian): when offline instantiate the BlockService with a bitswap
...
@@ -250,10 +256,10 @@ func initIdentity(cfg *config.Identity, peers peer.Peerstore, online bool) (peer
...
@@ -250,10 +256,10 @@ func initIdentity(cfg *config.Identity, peers peer.Peerstore, online bool) (peer
return
self
,
nil
return
self
,
nil
}
}
func
initConnections
(
ctx
context
.
Context
,
cfg
*
config
.
Config
,
pstore
peer
.
Peerstore
,
route
*
dht
.
IpfsDHT
)
{
func
initConnections
(
ctx
context
.
Context
,
bootstrap
[]
*
config
.
BootstrapPeer
,
pstore
peer
.
Peerstore
,
route
*
dht
.
IpfsDHT
)
{
// TODO consider stricter error handling
// TODO consider stricter error handling
// TODO consider Criticalf error logging
// TODO consider Criticalf error logging
for
_
,
p
:=
range
cfg
.
B
ootstrap
{
for
_
,
p
:=
range
b
ootstrap
{
if
p
.
PeerID
==
""
{
if
p
.
PeerID
==
""
{
log
.
Criticalf
(
"error: peer does not include PeerID. %v"
,
p
)
log
.
Criticalf
(
"error: peer does not include PeerID. %v"
,
p
)
}
}
...
...
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