mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/faucet: make a locked copy of f.reqs
This commit is contained in:
parent
80f692f123
commit
bad4dc2c99
1 changed files with 3 additions and 3 deletions
|
|
@ -361,17 +361,17 @@ func (f *faucet) apiHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
// Send over the initial stats and the latest header
|
// Send over the initial stats and the latest header
|
||||||
f.lock.RLock()
|
f.lock.RLock()
|
||||||
|
reqs := f.reqs
|
||||||
|
f.lock.RUnlock()
|
||||||
if err = send(conn, map[string]interface{}{
|
if err = send(conn, map[string]interface{}{
|
||||||
"funds": new(big.Int).Div(balance, ether),
|
"funds": new(big.Int).Div(balance, ether),
|
||||||
"funded": nonce,
|
"funded": nonce,
|
||||||
"peers": f.stack.Server().PeerCount(),
|
"peers": f.stack.Server().PeerCount(),
|
||||||
"requests": f.reqs,
|
"requests": reqs,
|
||||||
}, 3*time.Second); err != nil {
|
}, 3*time.Second); err != nil {
|
||||||
log.Warn("Failed to send initial stats to client", "err", err)
|
log.Warn("Failed to send initial stats to client", "err", err)
|
||||||
f.lock.RUnlock()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f.lock.RUnlock()
|
|
||||||
if err = send(conn, head, 3*time.Second); err != nil {
|
if err = send(conn, head, 3*time.Second); err != nil {
|
||||||
log.Warn("Failed to send initial header to client", "err", err)
|
log.Warn("Failed to send initial header to client", "err", err)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue