mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
minor
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
7f30c9e4d1
commit
3aa0f5bad2
1 changed files with 4 additions and 5 deletions
|
|
@ -353,6 +353,10 @@ func (api *FilterAPI) histLogs(notifier notifier, rpcSub *rpc.Subscription, from
|
||||||
|
|
||||||
// Compose and notify the logs from liveLogs and histLogs
|
// Compose and notify the logs from liveLogs and histLogs
|
||||||
go func() {
|
go func() {
|
||||||
|
defer func() {
|
||||||
|
liveLogsSub.Unsubscribe()
|
||||||
|
cancel()
|
||||||
|
}()
|
||||||
var (
|
var (
|
||||||
delivered uint64
|
delivered uint64
|
||||||
liveOnly bool
|
liveOnly bool
|
||||||
|
|
@ -364,7 +368,6 @@ func (api *FilterAPI) histLogs(notifier notifier, rpcSub *rpc.Subscription, from
|
||||||
case err := <-histDone:
|
case err := <-histDone:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warn("History logs delivery failed", "err", err)
|
logger.Warn("History logs delivery failed", "err", err)
|
||||||
liveLogsSub.Unsubscribe()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Else historical logs are all delivered, let's switch to live mode
|
// Else historical logs are all delivered, let's switch to live mode
|
||||||
|
|
@ -426,12 +429,8 @@ func (api *FilterAPI) histLogs(notifier notifier, rpcSub *rpc.Subscription, from
|
||||||
// Assuming batch = all logs of a single block
|
// Assuming batch = all logs of a single block
|
||||||
delivered = logs[0].BlockNumber
|
delivered = logs[0].BlockNumber
|
||||||
case <-rpcSub.Err(): // client send an unsubscribe request
|
case <-rpcSub.Err(): // client send an unsubscribe request
|
||||||
liveLogsSub.Unsubscribe()
|
|
||||||
cancel()
|
|
||||||
return
|
return
|
||||||
case <-notifier.Closed(): // connection dropped
|
case <-notifier.Closed(): // connection dropped
|
||||||
liveLogsSub.Unsubscribe()
|
|
||||||
cancel()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue