fix: scheduler success event (#891)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
dc50bd31d5
commit
04a3550925
|
|
@ -175,7 +175,11 @@ func (e peerDownloadPieceSuccessEvent) apply(s *state) {
|
||||||
|
|
||||||
var candidates []*supervisor.Peer
|
var candidates []*supervisor.Peer
|
||||||
parentPeer, ok := s.peerManager.Get(e.pr.DstPid)
|
parentPeer, ok := s.peerManager.Get(e.pr.DstPid)
|
||||||
if ok {
|
if !ok {
|
||||||
|
e.peer.Log().Warnf("parent peer %s not found", e.pr.DstPid)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if parentPeer.IsLeave() {
|
if parentPeer.IsLeave() {
|
||||||
e.peer.Log().Warnf("peerDownloadPieceSuccessEvent: need reschedule parent for peer because it's parent is already left")
|
e.peer.Log().Warnf("peerDownloadPieceSuccessEvent: need reschedule parent for peer because it's parent is already left")
|
||||||
e.peer.ReplaceParent(nil)
|
e.peer.ReplaceParent(nil)
|
||||||
|
|
@ -194,9 +198,6 @@ func (e peerDownloadPieceSuccessEvent) apply(s *state) {
|
||||||
e.pr.DstPid)
|
e.pr.DstPid)
|
||||||
e.peer.ReplaceParent(parentPeer)
|
e.peer.ReplaceParent(parentPeer)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
e.peer.Log().Warnf("parent peer %s not found", e.pr.DstPid)
|
|
||||||
}
|
|
||||||
|
|
||||||
parentPeer.Touch()
|
parentPeer.Touch()
|
||||||
if parentPeer.ID == e.pr.DstPid {
|
if parentPeer.ID == e.pr.DstPid {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue