eth, les: fix time sensitive unit tests (#20741)

This commit is contained in:
gary rong
2020-03-12 18:25:52 +08:00
committed by GitHub
parent b1efff659e
commit 92f3405dae
8 changed files with 52 additions and 39 deletions

View File

@ -157,6 +157,9 @@ func (h *serverHandler) handle(p *clientPeer) error {
clientConnectionGauge.Update(int64(h.server.peers.len()))
connectionTimer.Update(time.Duration(mclock.Now() - connectedAt))
}()
// Mark the peer starts to be served.
atomic.StoreUint32(&p.serving, 1)
defer atomic.StoreUint32(&p.serving, 0)
// Spawn a main loop to handle all incoming messages.
for {