@@ -17,7 +17,6 @@ limitations under the License.
17
17
package noopssinglechain
18
18
19
19
import (
20
- "sync/atomic"
21
20
"time"
22
21
23
22
"github.com/golang/protobuf/proto"
@@ -62,9 +61,6 @@ type DeliverService struct {
62
61
stateProvider state.GossipStateProvider
63
62
gossip gossip.Gossip
64
63
conn * grpc.ClientConn
65
-
66
- stopFlag int32
67
- stopChan chan bool
68
64
}
69
65
70
66
// StopDeliveryService sends stop to the delivery service reference
@@ -84,7 +80,6 @@ func NewDeliverService(chainID string, address string, grpcServer *grpc.Server)
84
80
// Instance of RawLedger
85
81
committer : committer .NewLedgerCommitter (kvledger .GetLedger (chainID )),
86
82
windowSize : 10 ,
87
- stopChan : make (chan bool ),
88
83
}
89
84
90
85
deliverService .initStateProvider (address , grpcServer )
@@ -176,9 +171,7 @@ func (d *DeliverService) Start() {
176
171
177
172
// Stop all service and release resources
178
173
func (d * DeliverService ) Stop () {
179
- atomic .StoreInt32 (& d .stopFlag , 1 )
180
174
d .stopDeliver ()
181
- d .stopChan <- true
182
175
d .stateProvider .Stop ()
183
176
d .gossip .Stop ()
184
177
}
@@ -189,8 +182,6 @@ func (d *DeliverService) checkLeaderAndRunDeliver() {
189
182
190
183
if isLeader {
191
184
d .startDeliver ()
192
- } else {
193
- <- d .stopChan
194
185
}
195
186
}
196
187
@@ -219,13 +210,6 @@ func (d *DeliverService) seekLatestFromCommitter(height uint64) error {
219
210
})
220
211
}
221
212
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
-
229
213
func isTxValidForVscc (payload * common.Payload , envBytes []byte ) error {
230
214
// TODO: Extract the VSCC/policy from LCCC as soon as this is ready
231
215
vscc := "vscc"
@@ -278,9 +262,6 @@ func (d *DeliverService) readUntilClose() {
278
262
msg , err := d .client .Recv ()
279
263
if err != nil {
280
264
logger .Warningf ("Receive error: %s" , err .Error ())
281
- if d .isDone () {
282
- <- d .stopChan
283
- }
284
265
return
285
266
}
286
267
switch t := msg .Type .(type ) {
0 commit comments