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
39d0b335
Commit
39d0b335
authored
Jan 16, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address CR feedback
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
52da1e32
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
core/bootstrap.go
core/bootstrap.go
+2
-2
core/core.go
core/core.go
+1
-1
test/sharness/t0121-bootstrap-iptb.sh
test/sharness/t0121-bootstrap-iptb.sh
+36
-1
No files found.
core/bootstrap.go
View file @
39d0b335
...
...
@@ -201,7 +201,7 @@ func bootstrapConnect(ctx context.Context, ph host.Host, peers []peer.PeerInfo)
return
nil
}
func
toPeerInfos
(
bpeers
[]
config
.
BootstrapPeer
)
(
[]
peer
.
PeerInfo
,
error
)
{
func
toPeerInfos
(
bpeers
[]
config
.
BootstrapPeer
)
[]
peer
.
PeerInfo
{
pinfos
:=
make
(
map
[
peer
.
ID
]
*
peer
.
PeerInfo
)
for
_
,
bootstrap
:=
range
bpeers
{
pinfo
,
ok
:=
pinfos
[
bootstrap
.
ID
()]
...
...
@@ -219,7 +219,7 @@ func toPeerInfos(bpeers []config.BootstrapPeer) ([]peer.PeerInfo, error) {
peers
=
append
(
peers
,
*
pinfo
)
}
return
peers
,
nil
return
peers
}
func
randomSubsetOfPeers
(
in
[]
peer
.
PeerInfo
,
max
int
)
[]
peer
.
PeerInfo
{
...
...
core/core.go
View file @
39d0b335
...
...
@@ -468,7 +468,7 @@ func (n *IpfsNode) loadBootstrapPeers() ([]peer.PeerInfo, error) {
if
err
!=
nil
{
return
nil
,
err
}
return
toPeerInfos
(
parsed
)
return
toPeerInfos
(
parsed
)
,
nil
}
func
(
n
*
IpfsNode
)
loadFilesRoot
()
error
{
...
...
test/sharness/t0121-bootstrap-iptb.sh
View file @
39d0b335
...
...
@@ -34,6 +34,41 @@ test_expect_success "setup iptb nodes" '
iptb init -n 5 -f --bootstrap=none --port=0
'
test_expect_success
"start up iptb nodes"
'
iptb start
'
test_expect_success
"check peers works"
'
ipfs swarm peers >peers_out
'
test_expect_success
"correct number of peers"
'
test -z "`cat peers_out`"
'
betterwait
()
{
while
kill
-0
$1
;
do
true
;
done
}
test_expect_success
"bring down iptb nodes"
'
PID0=$(cat "$IPTB_ROOT/0/daemon.pid") &&
PID1=$(cat "$IPTB_ROOT/1/daemon.pid") &&
PID2=$(cat "$IPTB_ROOT/2/daemon.pid") &&
PID3=$(cat "$IPTB_ROOT/3/daemon.pid") &&
PID4=$(cat "$IPTB_ROOT/4/daemon.pid") &&
iptb stop && # TODO: add --wait flag to iptb stop
betterwait $PID0
betterwait $PID1
betterwait $PID2
betterwait $PID3
betterwait $PID4
'
test_expect_success
"reset iptb nodes"
'
# the api doesnt seem to get cleaned up in sharness tests for some reason
iptb init -n 5 -f --bootstrap=none --port=0
'
test_expect_success
"set bootstrap addrs"
'
bsn_peer_id=$(ipfs id -f "<id>") &&
BADDR="/ip4/127.0.0.1/tcp/$PORT_SWARM/ipfs/$bsn_peer_id" &&
...
...
@@ -53,7 +88,7 @@ test_expect_success "check peers works" '
'
test_expect_success
"correct number of peers"
'
test `cat peers_out | wc -l` =
=
5
test `cat peers_out | wc -l` = 5
'
test_kill_ipfs_daemon
...
...
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