fix: skip check DisableAutoBackSource option when scheduler says back source (#693)
Signed-off-by: Jim Ma <majinjing3@gmail.com>
This commit is contained in:
parent
6343c8bdaf
commit
fc7eec17bf
|
|
@ -505,18 +505,11 @@ func (pt *peerTask) waitFirstPeerPacket() bool {
|
||||||
time.Now().Sub(pt.callback.GetStartTime()).Microseconds(), pt.peerPacket.Load().(*scheduler.PeerPacket).MainPeer)
|
time.Now().Sub(pt.callback.GetStartTime()).Microseconds(), pt.peerPacket.Load().(*scheduler.PeerPacket).MainPeer)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// when schedule timeout, receivePeerPacket will close pt.peerPacketReady
|
// when scheduler says dfcodes.SchedNeedBackSource, receivePeerPacket will close pt.peerPacketReady
|
||||||
if pt.schedulerOption.DisableAutoBackSource {
|
pt.Infof("start download from source due to dfcodes.SchedNeedBackSource")
|
||||||
pt.failedReason = reasonBackSourceDisabled
|
|
||||||
err := fmt.Errorf("%s, auto back source disabled", pt.failedReason)
|
|
||||||
pt.span.RecordError(err)
|
|
||||||
pt.Errorf(err.Error())
|
|
||||||
} else {
|
|
||||||
pt.Warnf("start download from source due to dfcodes.SchedNeedBackSource")
|
|
||||||
pt.span.AddEvent("back source due to scheduler says need back source")
|
pt.span.AddEvent("back source due to scheduler says need back source")
|
||||||
pt.needBackSource = true
|
pt.needBackSource = true
|
||||||
pt.backSource()
|
pt.backSource()
|
||||||
}
|
|
||||||
case <-time.After(pt.schedulerOption.ScheduleTimeout.Duration):
|
case <-time.After(pt.schedulerOption.ScheduleTimeout.Duration):
|
||||||
if pt.schedulerOption.DisableAutoBackSource {
|
if pt.schedulerOption.DisableAutoBackSource {
|
||||||
pt.failedReason = reasonScheduleTimeout
|
pt.failedReason = reasonScheduleTimeout
|
||||||
|
|
@ -555,18 +548,11 @@ func (pt *peerTask) waitAvailablePeerPacket() (int32, bool) {
|
||||||
// research from piece 0
|
// research from piece 0
|
||||||
return pt.getNextPieceNum(0), true
|
return pt.getNextPieceNum(0), true
|
||||||
}
|
}
|
||||||
// when schedule timeout, receivePeerPacket will close pt.peerPacketReady
|
// when scheduler says dfcodes.SchedNeedBackSource, receivePeerPacket will close pt.peerPacketReady
|
||||||
if pt.schedulerOption.DisableAutoBackSource {
|
pt.Infof("start download from source due to dfcodes.SchedNeedBackSource")
|
||||||
pt.failedReason = reasonBackSourceDisabled
|
|
||||||
err := fmt.Errorf("%s, auto back source disabled", pt.failedReason)
|
|
||||||
pt.span.RecordError(err)
|
|
||||||
pt.Errorf(err.Error())
|
|
||||||
} else {
|
|
||||||
pt.Warnf("start download from source due to dfcodes.SchedNeedBackSource")
|
|
||||||
pt.span.AddEvent("back source due to scheduler says need back source ")
|
pt.span.AddEvent("back source due to scheduler says need back source ")
|
||||||
pt.needBackSource = true
|
pt.needBackSource = true
|
||||||
pt.backSource()
|
pt.backSource()
|
||||||
}
|
|
||||||
case <-time.After(pt.schedulerOption.ScheduleTimeout.Duration):
|
case <-time.After(pt.schedulerOption.ScheduleTimeout.Duration):
|
||||||
if pt.schedulerOption.DisableAutoBackSource {
|
if pt.schedulerOption.DisableAutoBackSource {
|
||||||
pt.failedReason = reasonReScheduleTimeout
|
pt.failedReason = reasonReScheduleTimeout
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue