Skip to content

Commit 407f174

Browse files
committed
rpc:remove deprecated method "Notifier.Closed"
1 parent a732ad0 commit 407f174

File tree

7 files changed

+3
-24
lines changed

7 files changed

+3
-24
lines changed

eth/downloader/api.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ func (api *DownloaderAPI) Syncing(ctx context.Context) (*rpc.Subscription, error
149149
notifier.Notify(rpcSub.ID, status)
150150
case <-rpcSub.Err():
151151
return
152-
case <-notifier.Closed():
153-
return
154152
}
155153
}
156154
}()

eth/filters/api.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,6 @@ func (api *FilterAPI) NewPendingTransactions(ctx context.Context, fullTx *bool)
179179
}
180180
case <-rpcSub.Err():
181181
return
182-
case <-notifier.Closed():
183-
return
184182
}
185183
}
186184
}()
@@ -241,8 +239,6 @@ func (api *FilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
241239
notifier.Notify(rpcSub.ID, h)
242240
case <-rpcSub.Err():
243241
return
244-
case <-notifier.Closed():
245-
return
246242
}
247243
}
248244
}()
@@ -278,8 +274,6 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc
278274
}
279275
case <-rpcSub.Err(): // client send an unsubscribe request
280276
return
281-
case <-notifier.Closed(): // connection dropped
282-
return
283277
}
284278
}
285279
}()

eth/tracers/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func (api *API) TraceChain(ctx context.Context, start, end rpc.BlockNumber, conf
226226
}
227227
sub := notifier.CreateSubscription()
228228

229-
resCh := api.traceChain(from, to, config, notifier.Closed())
229+
resCh := api.traceChain(from, to, config, sub.Err())
230230
go func() {
231231
for result := range resCh {
232232
notifier.Notify(sub.ID, result)
@@ -240,7 +240,7 @@ func (api *API) TraceChain(ctx context.Context, start, end rpc.BlockNumber, conf
240240
// the end block but excludes the start one. The return value will be one item per
241241
// transaction, dependent on the requested tracer.
242242
// The tracing procedure should be aborted in case the closed signal is received.
243-
func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed <-chan interface{}) chan *blockTraceResult {
243+
func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed <-chan error) chan *blockTraceResult {
244244
reexec := defaultTraceReexec
245245
if config != nil && config.Reexec != nil {
246246
reexec = *config.Reexec

node/api.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ func (api *adminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription, error)
145145
return
146146
case <-rpcSub.Err():
147147
return
148-
case <-notifier.Closed():
149-
return
150148
}
151149
}
152150
}()

p2p/simulations/http_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ func (t *TestAPI) Events(ctx context.Context) (*rpc.Subscription, error) {
282282
return
283283
case <-rpcSub.Err():
284284
return
285-
case <-notifier.Closed():
286-
return
287285
}
288286
}
289287
}()

rpc/subscription.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ func (n *Notifier) Notify(id ID, data any) error {
145145
return nil
146146
}
147147

148-
// Closed returns a channel that is closed when the RPC connection is closed.
149-
// Deprecated: use subscription error channel
150-
func (n *Notifier) Closed() <-chan interface{} {
151-
return n.h.conn.closed()
152-
}
153-
154148
// takeSubscription returns the subscription (if one has been created). No subscription can
155149
// be created after this call.
156150
func (n *Notifier) takeSubscription() *Subscription {

rpc/testservice_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ func (s *notificationTestService) SomeSubscription(ctx context.Context, n, val i
195195
return
196196
}
197197
}
198-
select {
199-
case <-notifier.Closed():
200-
case <-subscription.Err():
201-
}
198+
<-subscription.Err()
202199
if s.unsubscribed != nil {
203200
s.unsubscribed <- string(subscription.ID)
204201
}

0 commit comments

Comments
 (0)