Skip to content

Commit 8309c15

Browse files
authored
Merge pull request #235 from CortexFoundation/dev
torrent/monitor | shutdown immediately and close exit channel
2 parents 9198be7 + 7539286 commit 8309c15

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

torrentfs/monitor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ func (m *Monitor) parseBlockTorrentInfo(b *Block, flowCtrl bool) error {
532532
func (m *Monitor) Stop() {
533533
log.Info("Torrent listener closing")
534534
atomic.StoreInt32(&(m.terminated), 1)
535-
//close(m.exitCh)
535+
close(m.exitCh)
536536
//m.wg.Wait()
537537
m.wg.Wait()
538538
/*m.wg.Add(1)
@@ -897,7 +897,7 @@ func (m *Monitor) syncLastBlock() uint64 {
897897
if atomic.LoadInt32(&(m.terminated)) == 1 {
898898
log.Warn("Torrent scan terminated", "number", i)
899899
maxNumber = i - 1
900-
close(m.exitCh)
900+
//close(m.exitCh)
901901
break
902902
}
903903

torrentfs/torrentClient.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ func (tm *TorrentManager) Close() error {
355355
}
356356

357357
func (tm *TorrentManager) dropAll() {
358-
//tm.lock.Lock()
359-
//tm.lock.Unlock()
358+
tm.lock.Lock()
359+
tm.lock.Unlock()
360360
defer tm.client.Close()
361361
for _, t := range tm.torrents {
362362
stats := t.Stats()

0 commit comments

Comments
 (0)