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
|
||||
go func() {
|
||||
defer func() {
|
||||
liveLogsSub.Unsubscribe()
|
||||
cancel()
|
||||
}()
|
||||
var (
|
||||
delivered uint64
|
||||
liveOnly bool
|
||||
|
|
@ -364,7 +368,6 @@ func (api *FilterAPI) histLogs(notifier notifier, rpcSub *rpc.Subscription, from
|
|||
case err := <-histDone:
|
||||
if err != nil {
|
||||
logger.Warn("History logs delivery failed", "err", err)
|
||||
liveLogsSub.Unsubscribe()
|
||||
return
|
||||
}
|
||||
// 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
|
||||
delivered = logs[0].BlockNumber
|
||||
case <-rpcSub.Err(): // client send an unsubscribe request
|
||||
liveLogsSub.Unsubscribe()
|
||||
cancel()
|
||||
return
|
||||
case <-notifier.Closed(): // connection dropped
|
||||
liveLogsSub.Unsubscribe()
|
||||
cancel()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue