Skip to content

Commit ebcc8b4

Browse files
committed
[FAB-1275] fix peer process doesn't stop issue
https://jira.hyperledger.org/projects/FAB/issues/FAB-1275 peer process doesn't stop if orderer is not started or stopped before peer. This is caused by block and wait on stopChan Change-Id: I7e14a25df052b345bb843671f82dc6d32dc490b5 Signed-off-by: Xi Xue Jia <[email protected]>
1 parent 71805c9 commit ebcc8b4

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

core/committer/noopssinglechain/client.go

-19
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package noopssinglechain
1818

1919
import (
20-
"sync/atomic"
2120
"time"
2221

2322
"github.com/golang/protobuf/proto"
@@ -62,9 +61,6 @@ type DeliverService struct {
6261
stateProvider state.GossipStateProvider
6362
gossip gossip.Gossip
6463
conn *grpc.ClientConn
65-
66-
stopFlag int32
67-
stopChan chan bool
6864
}
6965

7066
// StopDeliveryService sends stop to the delivery service reference
@@ -84,7 +80,6 @@ func NewDeliverService(chainID string, address string, grpcServer *grpc.Server)
8480
// Instance of RawLedger
8581
committer: committer.NewLedgerCommitter(kvledger.GetLedger(chainID)),
8682
windowSize: 10,
87-
stopChan: make(chan bool),
8883
}
8984

9085
deliverService.initStateProvider(address, grpcServer)
@@ -176,9 +171,7 @@ func (d *DeliverService) Start() {
176171

177172
// Stop all service and release resources
178173
func (d *DeliverService) Stop() {
179-
atomic.StoreInt32(&d.stopFlag, 1)
180174
d.stopDeliver()
181-
d.stopChan <- true
182175
d.stateProvider.Stop()
183176
d.gossip.Stop()
184177
}
@@ -189,8 +182,6 @@ func (d *DeliverService) checkLeaderAndRunDeliver() {
189182

190183
if isLeader {
191184
d.startDeliver()
192-
} else {
193-
<-d.stopChan
194185
}
195186
}
196187

@@ -219,13 +210,6 @@ func (d *DeliverService) seekLatestFromCommitter(height uint64) error {
219210
})
220211
}
221212

222-
// Internal function to check whenever we need to finish listening
223-
// for new messages to arrive
224-
func (d *DeliverService) isDone() bool {
225-
226-
return atomic.LoadInt32(&d.stopFlag) == 1
227-
}
228-
229213
func isTxValidForVscc(payload *common.Payload, envBytes []byte) error {
230214
// TODO: Extract the VSCC/policy from LCCC as soon as this is ready
231215
vscc := "vscc"
@@ -278,9 +262,6 @@ func (d *DeliverService) readUntilClose() {
278262
msg, err := d.client.Recv()
279263
if err != nil {
280264
logger.Warningf("Receive error: %s", err.Error())
281-
if d.isDone() {
282-
<-d.stopChan
283-
}
284265
return
285266
}
286267
switch t := msg.Type.(type) {

0 commit comments

Comments
 (0)