mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
eth/filters: dry
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
5cb56120b4
commit
a43785332f
1 changed files with 3 additions and 2 deletions
|
|
@ -37,6 +37,7 @@ import (
|
||||||
var (
|
var (
|
||||||
errInvalidTopic = errors.New("invalid topic(s)")
|
errInvalidTopic = errors.New("invalid topic(s)")
|
||||||
errFilterNotFound = errors.New("filter not found")
|
errFilterNotFound = errors.New("filter not found")
|
||||||
|
errConnectDropped = errors.New("connection dropped")
|
||||||
errInvalidToBlock = errors.New("log subscription does not support history block range")
|
errInvalidToBlock = errors.New("log subscription does not support history block range")
|
||||||
errInvalidFromBlock = errors.New("invalid from block")
|
errInvalidFromBlock = errors.New("invalid from block")
|
||||||
)
|
)
|
||||||
|
|
@ -375,7 +376,7 @@ func (api *FilterAPI) histLogs(ctx context.Context, notifier notifier, rpcSub *r
|
||||||
select {
|
select {
|
||||||
case <-notifier.Closed():
|
case <-notifier.Closed():
|
||||||
rmLogsSub.Unsubscribe()
|
rmLogsSub.Unsubscribe()
|
||||||
return 0, errors.New("connection dropped")
|
return 0, errConnectDropped
|
||||||
case err := <-rpcSub.Err(): // client send an unsubscribe request
|
case err := <-rpcSub.Err(): // client send an unsubscribe request
|
||||||
rmLogsSub.Unsubscribe()
|
rmLogsSub.Unsubscribe()
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
@ -402,7 +403,7 @@ func (api *FilterAPI) histLogs(ctx context.Context, notifier notifier, rpcSub *r
|
||||||
for _, log := range rmLogs {
|
for _, log := range rmLogs {
|
||||||
select {
|
select {
|
||||||
case <-notifier.Closed():
|
case <-notifier.Closed():
|
||||||
return head, errors.New("connection dropped")
|
return head, errConnectDropped
|
||||||
case err := <-rpcSub.Err(): // client send an unsubscribe request
|
case err := <-rpcSub.Err(): // client send an unsubscribe request
|
||||||
return head, err
|
return head, err
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue