aboutsummaryrefslogtreecommitdiffstats
path: root/les/request_test.go
diff options
context:
space:
mode:
authorZsolt Felfoldi <zsfelfoldi@gmail.com>2016-12-15 18:13:52 +0800
committerZsolt Felfoldi <zsfelfoldi@gmail.com>2017-01-06 11:34:31 +0800
commit93f9c023ccda2256079484d6c2a3159818ba6691 (patch)
treef2ed341904459184587ca1cc8667d8169761f752 /les/request_test.go
parente0ee0cc66a4416edd47232649f4d4bca4a5e3c07 (diff)
downloaddexon-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/request_test.go')
-rw-r--r--les/request_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/les/request_test.go b/les/request_test.go
index 03b946771..10e9edf8b 100644
--- a/les/request_test.go
+++ b/les/request_test.go
@@ -71,7 +71,8 @@ func testAccess(t *testing.T, protocol int, fn accessTestFn) {
pm, db, _ := 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):
@@ -102,10 +103,10 @@ func testAccess(t *testing.T, protocol int, fn accessTestFn) {
}
// 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(0)
- odr.serverPool = pool
+ pool.setPeer(lpeer)
// expect all retrievals to pass
test(5)
}