mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-18 06:13:42 +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 {
|
select {
|
||||||
case pc.blockQueueCh <- nil:
|
case pc.blockQueueCh <- nil:
|
||||||
break
|
break
|
||||||
|
case err := <-pc.downloadedCh:
|
||||||
|
return err
|
||||||
case err := <-pc.disconnectCh:
|
case err := <-pc.disconnectCh:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package torrent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"github.com/monkeyWie/gopeed/protocol/bt/metainfo"
|
"github.com/monkeyWie/gopeed/protocol/bt/metainfo"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"time"
|
"time"
|
||||||
@@ -43,7 +42,6 @@ func (t *Torrent) Download(path string) {
|
|||||||
index := t.pieces.getReady()
|
index := t.pieces.getReady()
|
||||||
// 没有待下载的piece了
|
// 没有待下载的piece了
|
||||||
if index == -1 {
|
if index == -1 {
|
||||||
fmt.Println("wait piece")
|
|
||||||
if <-t.completeCh {
|
if <-t.completeCh {
|
||||||
// 下载完成
|
// 下载完成
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in new issue
Block a user