diff options
author | Felix Lange <fjl@twurst.com> | 2015-02-19 08:52:03 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-02-19 23:54:53 +0800 |
commit | 73f94f37559ca0c8739c7dddeaf46d36827fdf30 (patch) | |
tree | 48e828b4a60c2bf2ea5b0ae917925af3b3b8ff01 /p2p/server_test.go | |
parent | 4322632c5924ef9aaaad1cdcdfa2f796c493cf69 (diff) | |
download | dexon-73f94f37559ca0c8739c7dddeaf46d36827fdf30.tar.gz dexon-73f94f37559ca0c8739c7dddeaf46d36827fdf30.tar.zst dexon-73f94f37559ca0c8739c7dddeaf46d36827fdf30.zip |
p2p: disable encryption handshake
The diff is a bit bigger than expected because the protocol handshake
logic has moved out of Peer. This is necessary because the protocol
handshake will have custom framing in the final protocol.
Diffstat (limited to 'p2p/server_test.go')
-rw-r--r-- | p2p/server_test.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/p2p/server_test.go b/p2p/server_test.go index aa2b3d243..c109fffb9 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -21,8 +21,12 @@ func startTestServer(t *testing.T, pf newPeerHook) *Server { ListenAddr: "127.0.0.1:0", PrivateKey: newkey(), newPeerHook: pf, - handshakeFunc: func(io.ReadWriter, *ecdsa.PrivateKey, *discover.Node) (id discover.NodeID, st []byte, err error) { - return randomID(), nil, err + setupFunc: func(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, dial *discover.Node) (*conn, error) { + id := randomID() + return &conn{ + frameRW: newFrameRW(fd, msgWriteTimeout), + protoHandshake: &protoHandshake{ID: id, Version: baseProtocolVersion}, + }, nil }, } if err := server.Start(); err != nil { @@ -116,9 +120,7 @@ func TestServerBroadcast(t *testing.T) { var connected sync.WaitGroup srv := startTestServer(t, func(p *Peer) { - p.protocols = []Protocol{discard} - p.startSubprotocols([]Cap{discard.cap()}) - p.noHandshake = true + p.running = matchProtocols([]Protocol{discard}, []Cap{discard.cap()}, p.rw) connected.Done() }) defer srv.Stop() |