rpc: remove deprecated method "Notifier.Closed" (#29162)
This commit is contained in:
parent
dfa6c5e9c8
commit
a6d6e8ac41
|
@ -149,8 +149,6 @@ func (api *DownloaderAPI) Syncing(ctx context.Context) (*rpc.Subscription, error
|
||||||
notifier.Notify(rpcSub.ID, status)
|
notifier.Notify(rpcSub.ID, status)
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -179,8 +179,6 @@ func (api *FilterAPI) NewPendingTransactions(ctx context.Context, fullTx *bool)
|
||||||
}
|
}
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -241,8 +239,6 @@ func (api *FilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
|
||||||
notifier.Notify(rpcSub.ID, h)
|
notifier.Notify(rpcSub.ID, h)
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -278,8 +274,6 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc
|
||||||
}
|
}
|
||||||
case <-rpcSub.Err(): // client send an unsubscribe request
|
case <-rpcSub.Err(): // client send an unsubscribe request
|
||||||
return
|
return
|
||||||
case <-notifier.Closed(): // connection dropped
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -226,7 +226,7 @@ func (api *API) TraceChain(ctx context.Context, start, end rpc.BlockNumber, conf
|
||||||
}
|
}
|
||||||
sub := notifier.CreateSubscription()
|
sub := notifier.CreateSubscription()
|
||||||
|
|
||||||
resCh := api.traceChain(from, to, config, notifier.Closed())
|
resCh := api.traceChain(from, to, config, sub.Err())
|
||||||
go func() {
|
go func() {
|
||||||
for result := range resCh {
|
for result := range resCh {
|
||||||
notifier.Notify(sub.ID, result)
|
notifier.Notify(sub.ID, result)
|
||||||
|
@ -240,7 +240,7 @@ func (api *API) TraceChain(ctx context.Context, start, end rpc.BlockNumber, conf
|
||||||
// the end block but excludes the start one. The return value will be one item per
|
// the end block but excludes the start one. The return value will be one item per
|
||||||
// transaction, dependent on the requested tracer.
|
// transaction, dependent on the requested tracer.
|
||||||
// The tracing procedure should be aborted in case the closed signal is received.
|
// The tracing procedure should be aborted in case the closed signal is received.
|
||||||
func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed <-chan interface{}) chan *blockTraceResult {
|
func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed <-chan error) chan *blockTraceResult {
|
||||||
reexec := defaultTraceReexec
|
reexec := defaultTraceReexec
|
||||||
if config != nil && config.Reexec != nil {
|
if config != nil && config.Reexec != nil {
|
||||||
reexec = *config.Reexec
|
reexec = *config.Reexec
|
||||||
|
|
|
@ -145,8 +145,6 @@ func (api *adminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription, error)
|
||||||
return
|
return
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -282,8 +282,6 @@ func (t *TestAPI) Events(ctx context.Context) (*rpc.Subscription, error) {
|
||||||
return
|
return
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -145,12 +145,6 @@ func (n *Notifier) Notify(id ID, data any) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closed returns a channel that is closed when the RPC connection is closed.
|
|
||||||
// Deprecated: use subscription error channel
|
|
||||||
func (n *Notifier) Closed() <-chan interface{} {
|
|
||||||
return n.h.conn.closed()
|
|
||||||
}
|
|
||||||
|
|
||||||
// takeSubscription returns the subscription (if one has been created). No subscription can
|
// takeSubscription returns the subscription (if one has been created). No subscription can
|
||||||
// be created after this call.
|
// be created after this call.
|
||||||
func (n *Notifier) takeSubscription() *Subscription {
|
func (n *Notifier) takeSubscription() *Subscription {
|
||||||
|
|
|
@ -195,10 +195,7 @@ func (s *notificationTestService) SomeSubscription(ctx context.Context, n, val i
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
select {
|
<-subscription.Err()
|
||||||
case <-notifier.Closed():
|
|
||||||
case <-subscription.Err():
|
|
||||||
}
|
|
||||||
if s.unsubscribed != nil {
|
if s.unsubscribed != nil {
|
||||||
s.unsubscribed <- string(subscription.ID)
|
s.unsubscribed <- string(subscription.ID)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue