diff options
| author | Randall Meyer <[email protected]> | 2023-02-15 10:34:04 -0800 |
|---|---|---|
| committer | Randall Meyer <[email protected]> | 2023-02-20 10:28:21 -0800 |
| commit | aba993ed378297f48ff6be18b17c6a963d3fd190 (patch) | |
| tree | c78832e8851c2dc39c4db56fbb3b2469802e9f1f /lgc | |
| parent | e0305ad041549f5f7ff90baa9cae58cf88a9c346 (diff) | |
lint/deprecation cleanup
Diffstat (limited to 'lgc')
| -rw-r--r-- | lgc/lgc.go | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -19,7 +19,6 @@ import ( "crypto/tls" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptrace" "sync" @@ -346,7 +345,7 @@ func (lgd *LoadGeneratingConnectionDownload) doDownload(ctx context.Context) { return } cr := &countingReader{n: &lgd.downloaded, ctx: ctx, readable: get.Body} - _, _ = io.Copy(ioutil.Discard, cr) + _, _ = io.Copy(io.Discard, cr) get.Body.Close() if debug.IsDebug(lgd.debug) { fmt.Printf("Ending a load-generating download.\n") @@ -373,12 +372,12 @@ func (lgu *LoadGeneratingConnectionUpload) ClientId() uint64 { return lgu.clientId } -func (lgd *LoadGeneratingConnectionUpload) TransferredInInterval() (uint64, time.Duration) { - transferred := atomic.SwapUint64(&lgd.uploaded, 0) - newIntervalEnd := (time.Now().Sub(lgd.uploadStartTime)).Nanoseconds() - previousIntervalEnd := atomic.SwapInt64(&lgd.lastIntervalEnd, newIntervalEnd) +func (lgu *LoadGeneratingConnectionUpload) TransferredInInterval() (uint64, time.Duration) { + transferred := atomic.SwapUint64(&lgu.uploaded, 0) + newIntervalEnd := (time.Now().Sub(lgu.uploadStartTime)).Nanoseconds() + previousIntervalEnd := atomic.SwapInt64(&lgu.lastIntervalEnd, newIntervalEnd) intervalLength := time.Duration(newIntervalEnd - previousIntervalEnd) - if debug.IsDebug(lgd.debug) { + if debug.IsDebug(lgu.debug) { fmt.Printf("upload: Transferred: %v bytes in %v.\n", transferred, intervalLength) } return transferred, intervalLength |
