mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-30 11:45:37 +00:00
lint: cleanup pending lint errors (#7237)
This commit is contained in:
@@ -23,16 +23,16 @@ var (
|
||||
type Subscription struct {
|
||||
out chan Message
|
||||
|
||||
cancelled chan struct{}
|
||||
mtx tmsync.RWMutex
|
||||
err error
|
||||
canceled chan struct{}
|
||||
mtx tmsync.RWMutex
|
||||
err error
|
||||
}
|
||||
|
||||
// NewSubscription returns a new subscription with the given outCapacity.
|
||||
func NewSubscription(outCapacity int) *Subscription {
|
||||
return &Subscription{
|
||||
out: make(chan Message, outCapacity),
|
||||
cancelled: make(chan struct{}),
|
||||
out: make(chan Message, outCapacity),
|
||||
canceled: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,13 +43,14 @@ func (s *Subscription) Out() <-chan Message {
|
||||
return s.out
|
||||
}
|
||||
|
||||
// nolint: misspell
|
||||
// Cancelled returns a channel that's closed when the subscription is
|
||||
// terminated and supposed to be used in a select statement.
|
||||
func (s *Subscription) Cancelled() <-chan struct{} {
|
||||
return s.cancelled
|
||||
return s.canceled
|
||||
}
|
||||
|
||||
// Err returns nil if the channel returned by Cancelled is not yet closed.
|
||||
// Err returns nil if the channel returned is not yet closed.
|
||||
// If the channel is closed, Err returns a non-nil error explaining why:
|
||||
// - ErrUnsubscribed if the subscriber choose to unsubscribe,
|
||||
// - ErrOutOfCapacity if the subscriber is not pulling messages fast enough
|
||||
@@ -66,7 +67,7 @@ func (s *Subscription) cancel(err error) {
|
||||
s.mtx.Lock()
|
||||
s.err = err
|
||||
s.mtx.Unlock()
|
||||
close(s.cancelled)
|
||||
close(s.canceled)
|
||||
}
|
||||
|
||||
// Message glues data and events together.
|
||||
|
||||
Reference in New Issue
Block a user