Rate limit sent data, not uncompressed

This commit is contained in:
Jakob Borg
2014-04-01 20:36:54 +02:00
parent 76e0960a51
commit a1f32095df
3 changed files with 36 additions and 20 deletions

View File

@@ -18,7 +18,6 @@ import (
"github.com/calmh/syncthing/lamport"
"github.com/calmh/syncthing/protocol"
"github.com/calmh/syncthing/scanner"
"github.com/juju/ratelimit"
)
type Model struct {
@@ -36,8 +35,6 @@ type Model struct {
sup suppressor
limitRequestRate *ratelimit.Bucket
addedRepo bool
started bool
}
@@ -66,10 +63,6 @@ func NewModel(maxChangeBw int) *Model {
return m
}
func (m *Model) LimitRate(kbps int) {
m.limitRequestRate = ratelimit.NewBucketWithRate(float64(kbps), int64(5*kbps))
}
// StartRW starts read/write processing on the current model. When in
// read/write mode the model will attempt to keep in sync with the cluster by
// pulling needed files from peer nodes.
@@ -351,10 +344,6 @@ func (m *Model) Request(nodeID, repo, name string, offset int64, size int) ([]by
return nil, err
}
if m.limitRequestRate != nil {
m.limitRequestRate.Wait(int64(size / 1024))
}
return buf, nil
}