diff options
author | Felix Lange <fjl@twurst.com> | 2015-05-14 23:41:43 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-05-25 07:17:14 +0800 |
commit | dbdc5fd4b33ad98ebde72e7d934cebab1408f057 (patch) | |
tree | 79d6b8827555b0220a89456d3132f40ed0f9b291 /p2p/server_test.go | |
parent | 2f249fea448a10ae0986a140f5a52d8a310e57fe (diff) | |
download | dexon-dbdc5fd4b33ad98ebde72e7d934cebab1408f057.tar dexon-dbdc5fd4b33ad98ebde72e7d934cebab1408f057.tar.gz dexon-dbdc5fd4b33ad98ebde72e7d934cebab1408f057.tar.bz2 dexon-dbdc5fd4b33ad98ebde72e7d934cebab1408f057.tar.lz dexon-dbdc5fd4b33ad98ebde72e7d934cebab1408f057.tar.xz dexon-dbdc5fd4b33ad98ebde72e7d934cebab1408f057.tar.zst dexon-dbdc5fd4b33ad98ebde72e7d934cebab1408f057.zip |
p2p: delete Server.Broadcast
Diffstat (limited to 'p2p/server_test.go')
-rw-r--r-- | p2p/server_test.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/p2p/server_test.go b/p2p/server_test.go index 55fc81572..6f7aaf8e1 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -1,12 +1,9 @@ package p2p import ( - "bytes" "crypto/ecdsa" - "io" "math/rand" "net" - "sync" "testing" "time" @@ -121,45 +118,6 @@ func TestServerDial(t *testing.T) { } } -func TestServerBroadcast(t *testing.T) { - var connected sync.WaitGroup - srv := startTestServer(t, func(p *Peer) { - p.running = matchProtocols([]Protocol{discard}, []Cap{discard.cap()}, p.rw) - connected.Done() - }) - defer srv.Stop() - - // create a few peers - var conns = make([]net.Conn, 8) - connected.Add(len(conns)) - deadline := time.Now().Add(3 * time.Second) - dialer := &net.Dialer{Deadline: deadline} - for i := range conns { - conn, err := dialer.Dial("tcp", srv.ListenAddr) - if err != nil { - t.Fatalf("conn %d: dial error: %v", i, err) - } - defer conn.Close() - conn.SetDeadline(deadline) - conns[i] = conn - } - connected.Wait() - - // broadcast one message - srv.Broadcast("discard", 0, []string{"foo"}) - golden := unhex("66e94d166f0a2c3b884cfa59ca34") - - // check that the message has been written everywhere - for i, conn := range conns { - buf := make([]byte, len(golden)) - if _, err := io.ReadFull(conn, buf); err != nil { - t.Errorf("conn %d: read error: %v", i, err) - } else if !bytes.Equal(buf, golden) { - t.Errorf("conn %d: msg mismatch\ngot: %x\nwant: %x", i, buf, golden) - } - } -} - // This test checks that connections are disconnected // just after the encryption handshake when the server is // at capacity. |