Skip to content

Commit

Permalink
Merge pull request #218 from m-lab/sandbox-roberto
Browse files Browse the repository at this point in the history
Fix timeout at the end of S2C tests
  • Loading branch information
robertodauria authored Nov 13, 2019
2 parents 1885e98 + 8d36f81 commit 5b5d4af
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ndt5/web100/web100_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ func summarize(snaps []*tcp.LinuxTCPInfo) (*Metrics, error) {
info := &Metrics{
TCPInfo: *snaps[len(snaps)-1], // Save the last snapshot of TCPInfo data into the metric struct.

MinRTT: minrtt / 1000, // tcpinfo is microsecond data, web100 needs milliseconds
MaxRTT: maxrtt / 1000, // tcpinfo is microsecond data, web100 needs milliseconds
SumRTT: sumrtt / 1000, // tcpinfo is microsecond data, web100 needs milliseconds
MinRTT: minrtt / 1000, // tcpinfo is microsecond data, web100 needs milliseconds
MaxRTT: maxrtt / 1000, // tcpinfo is microsecond data, web100 needs milliseconds
SumRTT: sumrtt / 1000, // tcpinfo is microsecond data, web100 needs milliseconds

CountRTT: countrtt, // This counts how many samples went into SumRTT

Expand All @@ -53,6 +53,9 @@ func summarize(snaps []*tcp.LinuxTCPInfo) (*Metrics, error) {

func measureUntilContextCancellation(ctx context.Context, fp *os.File) (*Metrics, error) {
ticker := time.NewTicker(100 * time.Millisecond)
// We need to make sure fp is closed when the polling loop ends to ensure legacy
// clients work. See https://github.com/m-lab/ndt-server/issues/160.
defer fp.Close()
defer ticker.Stop()

snaps := make([]*tcp.LinuxTCPInfo, 0, 200) // Enough space for 20 seconds of data.
Expand Down

0 comments on commit 5b5d4af

Please sign in to comment.