Skip to content

Commit

Permalink
chore: remove unnecessary mutex from base reactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Jan 23, 2025
1 parent e1d57c9 commit 6ccb904
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions p2p/base_reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"github.com/gogo/protobuf/proto"
"github.com/tendermint/tendermint/libs/service"
"github.com/tendermint/tendermint/libs/sync"
"github.com/tendermint/tendermint/p2p/conn"
"github.com/tendermint/tendermint/pkg/trace/schema"
"reflect"
Expand Down Expand Up @@ -80,7 +79,6 @@ type EnvelopeReceiver interface {
//--------------------------------------

type BaseReactor struct {
sync.Mutex
service.BaseService // Provides Start, Stop, .Quit
Switch *Switch

Expand All @@ -95,7 +93,6 @@ type ReactorOptions func(*BaseReactor)

func NewBaseReactor(name string, impl Reactor, opts ...ReactorOptions) *BaseReactor {
base := &BaseReactor{
Mutex: sync.Mutex{},
BaseService: *service.NewBaseService(nil, name, impl),
Switch: nil,
incoming: make(chan UnprocessedEnvelope, 100),
Expand Down Expand Up @@ -144,14 +141,10 @@ func (br *BaseReactor) SetSwitch(sw *Switch) {
// queue to avoid blocking. The size of the queue can be changed by passing
// options to the base reactor.
func (br *BaseReactor) QueueUnprocessedEnvelope(e UnprocessedEnvelope) {
br.Lock()
defer br.Unlock()
br.incoming <- e
}

func (br *BaseReactor) OnStop() {
br.Lock()
defer br.Unlock()
close(br.incoming)
}

Expand Down

0 comments on commit 6ccb904

Please sign in to comment.