diff options
author | Zsolt Felfoldi <zsfelfoldi@gmail.com> | 2016-12-15 18:13:52 +0800 |
---|---|---|
committer | Zsolt Felfoldi <zsfelfoldi@gmail.com> | 2017-01-06 11:34:31 +0800 |
commit | 93f9c023ccda2256079484d6c2a3159818ba6691 (patch) | |
tree | f2ed341904459184587ca1cc8667d8169761f752 /les/odr_test.go | |
parent | e0ee0cc66a4416edd47232649f4d4bca4a5e3c07 (diff) | |
download | dexon-93f9c023ccda2256079484d6c2a3159818ba6691.tar dexon-93f9c023ccda2256079484d6c2a3159818ba6691.tar.gz dexon-93f9c023ccda2256079484d6c2a3159818ba6691.tar.bz2 dexon-93f9c023ccda2256079484d6c2a3159818ba6691.tar.lz dexon-93f9c023ccda2256079484d6c2a3159818ba6691.tar.xz dexon-93f9c023ccda2256079484d6c2a3159818ba6691.tar.zst dexon-93f9c023ccda2256079484d6c2a3159818ba6691.zip |
les: fixed selectPeer deadlock, improved request distribution
les/flowcontrol: using proper types for relative and absolute times
Diffstat (limited to 'les/odr_test.go')
-rw-r--r-- | les/odr_test.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/les/odr_test.go b/les/odr_test.go index b5cbda838..622d89e5c 100644 --- a/les/odr_test.go +++ b/les/odr_test.go @@ -160,7 +160,8 @@ func testOdr(t *testing.T, protocol int, expFail uint64, fn odrTestFn) { pm, db, odr := newTestProtocolManagerMust(t, false, 4, testChainGen) lpm, ldb, odr := newTestProtocolManagerMust(t, true, 0, nil) _, err1, lpeer, err2 := newTestPeerPair("peer", protocol, pm, lpm) - pool := (*testServerPool)(lpeer) + pool := &testServerPool{} + pool.setPeer(lpeer) odr.serverPool = pool select { case <-time.After(time.Millisecond * 100): @@ -190,13 +191,13 @@ func testOdr(t *testing.T, protocol int, expFail uint64, fn odrTestFn) { } // temporarily remove peer to test odr fails - odr.serverPool = nil + pool.setPeer(nil) // expect retrievals to fail (except genesis block) without a les peer test(expFail) - odr.serverPool = pool + pool.setPeer(lpeer) // expect all retrievals to pass test(5) - odr.serverPool = nil + pool.setPeer(nil) // still expect all retrievals to pass, now data should be cached locally test(5) } |