improved logging
This commit is contained in:
6
main.go
6
main.go
@@ -147,14 +147,14 @@ func (m UploadManager) pingWorker() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if m.isBWInRange(up + conf.Bandwidth.Step) {
|
if m.isBWInRange(up + conf.Bandwidth.Step) {
|
||||||
log.Infof("short ping %s, trying to increase upload TC %d->%d", stats.AvgRtt, up, up+conf.Bandwidth.Step)
|
log.Infof("short ping %s, trying to increase upload TC %f->%f", stats.AvgRtt, up, up+conf.Bandwidth.Step)
|
||||||
up, err = m.SetUpload(up + conf.Bandwidth.Step)
|
up, err = m.SetUpload(up + conf.Bandwidth.Step)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
m.LastOver = time.Now()
|
m.LastOver = time.Now()
|
||||||
|
|
||||||
log.Infof("upload TC increased to %d, measuring latency", up)
|
log.Infof("upload TC increased to %f, measuring latency", up)
|
||||||
stats, err = doPing(conf.Host, conf.ConformationPPP, time.Second)
|
stats, err = doPing(conf.Host, conf.ConformationPPP, time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("ping to %s failed: %v", conf.Host, err)
|
log.Warningf("ping to %s failed: %v", conf.Host, err)
|
||||||
@@ -163,7 +163,7 @@ func (m UploadManager) pingWorker() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if stats.AvgRtt.Milliseconds() >= conf.ThrottlePingThreshold {
|
if stats.AvgRtt.Milliseconds() >= conf.ThrottlePingThreshold {
|
||||||
log.Infof("increase failed with %s ping, reverting to %d", stats.AvgRtt, up-conf.Bandwidth.Step)
|
log.Infof("increase failed with %s ping, reverting to %f", stats.AvgRtt, up-conf.Bandwidth.Step)
|
||||||
_, err = m.SetUpload(up - conf.Bandwidth.Step)
|
_, err = m.SetUpload(up - conf.Bandwidth.Step)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user