add wait for empty reporting channel before closing

This commit is contained in:
Ben Grewell
2021-03-11 09:16:21 -08:00
parent 2327d13022
commit 1dd7340d4b
2 changed files with 2 additions and 1 deletions

1
.idea/workspace.xml generated
View File

@@ -2,7 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="fc2840de-29dc-4fca-8e0e-a283562f60ca" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/reporter.go" beforeDir="false" afterPath="$PROJECT_DIR$/reporter.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />

View File

@@ -2,6 +2,7 @@ package iperf
import (
"github.com/BGrewell/tail"
"time"
)
type Reporter struct {
@@ -24,6 +25,7 @@ func (r *Reporter) Stop() {
if len(r.ReportingChannel) == 0 {
break
}
time.Sleep(1 * time.Millisecond)
}
close(r.ReportingChannel)
}