Send external addresses upon new outbound peer

This commit is contained in:
Jae Kwon
2014-07-14 14:04:26 -07:00
parent 78663a09fe
commit 56a92b512f
9 changed files with 377 additions and 253 deletions

View File

@@ -67,25 +67,25 @@ func TestSwitches(t *testing.T) {
}
// Broadcast a message on ch1
s1.Broadcast(NewPacket("ch1", ByteSlice("channel one")))
s1.Broadcast(NewPacket("ch1", String("channel one")))
// Broadcast a message on ch2
s1.Broadcast(NewPacket("ch2", ByteSlice("channel two")))
s1.Broadcast(NewPacket("ch2", String("channel two")))
// Broadcast a message on ch3
s1.Broadcast(NewPacket("ch3", ByteSlice("channel three")))
s1.Broadcast(NewPacket("ch3", String("channel three")))
// Wait for things to settle...
time.Sleep(100 * time.Millisecond)
// Receive message from channel 2 and check
inMsg := s2.Receive("ch2")
if string(inMsg.Bytes) != "channel two" {
t.Errorf("Unexpected received message bytes: %v", string(inMsg.Bytes))
if ReadString(inMsg.Reader()) != "channel two" {
t.Errorf("Unexpected received message bytes: %X = [%v]", inMsg.Bytes, ReadString(inMsg.Reader()))
}
// Receive message from channel 1 and check
inMsg = s2.Receive("ch1")
if string(inMsg.Bytes) != "channel one" {
t.Errorf("Unexpected received message bytes: %v", string(inMsg.Bytes))
if ReadString(inMsg.Reader()) != "channel one" {
t.Errorf("Unexpected received message bytes: %X = [%v]", inMsg.Bytes, ReadString(inMsg.Reader()))
}
}