|
@ -1,8 +1,6 @@ |
|
|
package core |
|
|
package core |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"fmt" |
|
|
|
|
|
|
|
|
|
|
|
ctypes "github.com/tendermint/tendermint/rpc/core/types" |
|
|
ctypes "github.com/tendermint/tendermint/rpc/core/types" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@ -31,12 +29,8 @@ func NetInfo() (*ctypes.ResultNetInfo, error) { |
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
// Dial given list of seeds if we have no outbound peers
|
|
|
|
|
|
|
|
|
// Dial given list of seeds
|
|
|
func DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) { |
|
|
func DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) { |
|
|
outbound, _, _ := p2pSwitch.NumPeers() |
|
|
|
|
|
if outbound != 0 { |
|
|
|
|
|
return nil, fmt.Errorf("Already have some outbound peers") |
|
|
|
|
|
} |
|
|
|
|
|
// starts go routines to dial each seed after random delays
|
|
|
// starts go routines to dial each seed after random delays
|
|
|
p2pSwitch.DialSeeds(seeds) |
|
|
p2pSwitch.DialSeeds(seeds) |
|
|
return &ctypes.ResultDialSeeds{}, nil |
|
|
return &ctypes.ResultDialSeeds{}, nil |
|
|