OSDN Git Service
(root)
/
bytom
/
bytom.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6a64dd0
)
Add peer start dial seeds function
author
Yahtoo Ma
<yahtoo.ma@gmail.com>
Sun, 22 Apr 2018 05:36:54 +0000
(13:36 +0800)
committer
Yahtoo Ma
<yahtoo.ma@gmail.com>
Sun, 22 Apr 2018 05:36:54 +0000
(13:36 +0800)
p2p/switch.go
patch
|
blob
|
history
diff --git
a/p2p/switch.go
b/p2p/switch.go
index
f009929
..
d2f8f0f
100644
(file)
--- a/
p2p/switch.go
+++ b/
p2p/switch.go
@@
-329,6
+329,12
@@
func (sw *Switch) DialSeeds(addrBook *AddrBook, seeds []string) error {
addrBook.Save()
}
+ //permute the list, dial them in random order.
+ perm := rand.Perm(len(netAddrs))
+ for i := 0; i < len(perm)/2; i++ {
+ j := perm[i]
+ sw.dialSeed(netAddrs[j])
+ }
return nil
}