@@ -185,7 +185,7 @@ func (s *Server) PingAndJitter(count int) (float64, float64, error) {
185185}
186186
187187// Download performs the actual download test
188- func (s * Server ) Download (silent bool , useBytes , useMebi bool , requests int ) (float64 , int , error ) {
188+ func (s * Server ) Download (silent bool , useBytes , useMebi bool , requests int , chunks int , duration time. Duration ) (float64 , int , error ) {
189189 t := time .Now ()
190190 defer func () {
191191 s .TLog .Logf ("Download took %s" , time .Now ().Sub (t ).String ())
@@ -210,7 +210,7 @@ func (s *Server) Download(silent bool, useBytes, useMebi bool, requests int) (fl
210210 return 0 , 0 , err
211211 }
212212 q := req .URL .Query ()
213- q .Set ("ckSize" , strconv .Itoa (downloadChunks ))
213+ q .Set ("ckSize" , strconv .Itoa (chunks ))
214214 req .URL .RawQuery = q .Encode ()
215215 req .Header .Set ("User-Agent" , UserAgent )
216216 req .Header .Set ("Accept-Encoding" , "identity" )
@@ -261,7 +261,7 @@ func (s *Server) Download(silent bool, useBytes, useMebi bool, requests int) (fl
261261 go doDownload ()
262262 time .Sleep (200 * time .Millisecond )
263263 }
264- timeout := time .After (15 * time . Second )
264+ timeout := time .After (duration )
265265Loop:
266266 for {
267267 select {
@@ -277,14 +277,15 @@ Loop:
277277}
278278
279279// Upload performs the actual upload test
280- func (s * Server ) Upload (noPrealloc , silent , useBytes , useMebi bool , requests int ) (float64 , int , error ) {
280+ func (s * Server ) Upload (noPrealloc , silent , useBytes , useMebi bool , requests int , uploadSize int , duration time. Duration ) (float64 , int , error ) {
281281 t := time .Now ()
282282 defer func () {
283283 s .TLog .Logf ("Upload took %s" , time .Now ().Sub (t ).String ())
284284 }()
285285
286286 counter := NewCounter ()
287287 counter .SetMebi (useMebi )
288+ counter .SetUploadSize (uploadSize )
288289
289290 if noPrealloc {
290291 log .Info ("Pre-allocation is disabled, performance might be lower!" )
@@ -353,7 +354,7 @@ func (s *Server) Upload(noPrealloc, silent, useBytes, useMebi bool, requests int
353354 go doUpload ()
354355 time .Sleep (200 * time .Millisecond )
355356 }
356- timeout := time .After (15 * time . Second )
357+ timeout := time .After (duration )
357358Loop:
358359 for {
359360 select {
0 commit comments