File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -116,19 +116,21 @@ func (memR *MempoolReactor) broadcastTxRoutine(peer p2p.Peer) {
116116
117117 var next * clist.CElement
118118 for {
119+ select {
120+ case <- peer .Quit ():
121+ return
122+ case <- memR .Quit ():
123+ return
124+ default :
125+ // continue to broadcast transaction
126+ }
119127 // This happens because the CElement we were looking at got garbage
120128 // collected (removed). That is, .NextWait() returned nil. Go ahead and
121129 // start from the beginning.
122130 if next == nil {
123- select {
124- case <- memR .Mempool .TxsWaitChan (): // Wait until a tx is available
125- if next = memR .Mempool .TxsFront (); next == nil {
126- continue
127- }
128- case <- peer .Quit ():
129- return
130- case <- memR .Quit ():
131- return
131+ <- memR .Mempool .TxsWaitChan () // Wait until a tx is available
132+ if next = memR .Mempool .TxsFront (); next == nil {
133+ continue
132134 }
133135 }
134136
You can’t perform that action at this time.
0 commit comments