|
|
@ -49,6 +49,8 @@ func CreateRoutableAddr() (addr string, netAddr *NetAddress) { |
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Connects switches via arbitrary net.Conn. Used for testing.
|
|
|
|
|
|
|
|
const TEST_HOST = "localhost" |
|
|
|
|
|
|
|
// MakeConnectedSwitches returns n switches, connected according to the connect func.
|
|
|
|
// If connect==Connect2Switches, the switches will be fully connected.
|
|
|
|
// initSwitch defines how the i'th switch should be initialized (ie. with what reactors).
|
|
|
@ -56,7 +58,7 @@ func CreateRoutableAddr() (addr string, netAddr *NetAddress) { |
|
|
|
func MakeConnectedSwitches(cfg *cfg.P2PConfig, n int, initSwitch func(int, *Switch) *Switch, connect func([]*Switch, int, int)) []*Switch { |
|
|
|
switches := make([]*Switch, n) |
|
|
|
for i := 0; i < n; i++ { |
|
|
|
switches[i] = MakeSwitch(cfg, i, "testing", "123.123.123", initSwitch) |
|
|
|
switches[i] = MakeSwitch(cfg, i, TEST_HOST, "123.123.123", initSwitch) |
|
|
|
} |
|
|
|
|
|
|
|
if err := StartSwitches(switches); err != nil { |
|
|
|