Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc:remove deprecated method "Notifier.Closed" #29162

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions eth/downloader/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ func (api *DownloaderAPI) Syncing(ctx context.Context) (*rpc.Subscription, error
notifier.Notify(rpcSub.ID, status)
case <-rpcSub.Err():
return
case <-notifier.Closed():
return
}
}
}()
Expand Down
6 changes: 0 additions & 6 deletions eth/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ func (api *FilterAPI) NewPendingTransactions(ctx context.Context, fullTx *bool)
}
case <-rpcSub.Err():
return
case <-notifier.Closed():
return
}
}
}()
Expand Down Expand Up @@ -241,8 +239,6 @@ func (api *FilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
notifier.Notify(rpcSub.ID, h)
case <-rpcSub.Err():
return
case <-notifier.Closed():
return
}
}
}()
Expand Down Expand Up @@ -278,8 +274,6 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc
}
case <-rpcSub.Err(): // client send an unsubscribe request
return
case <-notifier.Closed(): // connection dropped
return
}
}
}()
Expand Down
4 changes: 2 additions & 2 deletions eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func (api *API) TraceChain(ctx context.Context, start, end rpc.BlockNumber, conf
}
sub := notifier.CreateSubscription()

resCh := api.traceChain(from, to, config, notifier.Closed())
resCh := api.traceChain(from, to, config, sub.Err())
go func() {
for result := range resCh {
notifier.Notify(sub.ID, result)
Expand All @@ -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
// transaction, dependent on the requested tracer.
// 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
if config != nil && config.Reexec != nil {
reexec = *config.Reexec
Expand Down
2 changes: 0 additions & 2 deletions node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ func (api *adminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription, error)
return
case <-rpcSub.Err():
return
case <-notifier.Closed():
return
}
}
}()
Expand Down
2 changes: 0 additions & 2 deletions p2p/simulations/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ func (t *TestAPI) Events(ctx context.Context) (*rpc.Subscription, error) {
return
case <-rpcSub.Err():
return
case <-notifier.Closed():
return
}
}
}()
Expand Down
6 changes: 0 additions & 6 deletions rpc/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ func (n *Notifier) Notify(id ID, data any) error {
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
// be created after this call.
func (n *Notifier) takeSubscription() *Subscription {
Expand Down
5 changes: 1 addition & 4 deletions rpc/testservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ func (s *notificationTestService) SomeSubscription(ctx context.Context, n, val i
return
}
}
select {
case <-notifier.Closed():
case <-subscription.Err():
}
<-subscription.Err()
if s.unsubscribed != nil {
s.unsubscribed <- string(subscription.ID)
}
Expand Down
Loading