Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Angelo De Caro <[email protected]>
  • Loading branch information
adecaro committed Jan 28, 2025
1 parent 0db3872 commit acf7fe9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions platform/fabric/core/generic/delivery/delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
var logger = logging.MustGetLogger("fabric-sdk.delivery")

var (
ErrComm = errors.New("communication issue")
StartGenesis = &ab.SeekPosition{
Type: &ab.SeekPosition_Oldest{
Oldest: &ab.SeekOldest{},
Expand Down Expand Up @@ -84,6 +83,10 @@ type Delivery struct {
stop chan error
}

var (
ctr = atomic.Uint32{}
)

func New(
networkName string,
channelConfig driver.ChannelConfig,
Expand Down Expand Up @@ -137,16 +140,6 @@ func (d *Delivery) Stop(err error) {
close(d.stop)
}

var ctr = atomic.Uint32{}

func (d *Delivery) untilStop() error {
for err := range d.stop {
logger.Infof("Stopping delivery service")
return err
}
return nil
}

func (d *Delivery) Run(ctx context.Context) error {
logger.Debugf("Running delivery service [%d]", ctr.Add(1))
if ctx == nil {
Expand Down Expand Up @@ -278,6 +271,14 @@ func (d *Delivery) runReceiver(ctx context.Context, ch chan<- blockResponse) {
}
}

func (d *Delivery) untilStop() error {
for err := range d.stop {
logger.Infof("Stopping delivery service")
return err
}
return nil
}

func (d *Delivery) connect(ctx context.Context) (DeliverStream, error) {
// first cleanup everything
d.cleanup()
Expand Down

0 comments on commit acf7fe9

Please sign in to comment.