mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-06 08:30:29 +00:00
fix: piece下载死锁
This commit is contained in:
1 parent
ee4ff7dd8b
commit
b0bd2a776a
2 files changed
+2
-2
No files matched your search
@@ -212,6 +212,8 @@ func (pc *peerConn) downloadPiece(index int) error {
|
||||
select {
|
||||
case pc.blockQueueCh <- nil:
|
||||
break
|
||||
case err := <-pc.downloadedCh:
|
||||
return err
|
||||
case err := <-pc.disconnectCh:
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package torrent
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/monkeyWie/gopeed/protocol/bt/metainfo"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"time"
|
||||
@@ -43,7 +42,6 @@ func (t *Torrent) Download(path string) {
|
||||
index := t.pieces.getReady()
|
||||
// 没有待下载的piece了
|
||||
if index == -1 {
|
||||
fmt.Println("wait piece")
|
||||
if <-t.completeCh {
|
||||
// 下载完成
|
||||
break
|
||||
|
||||
Reference in new issue
Block a user