|
|
|
@ -7,6 +7,7 @@ import (
|
|
|
|
|
"log"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -44,9 +45,10 @@ Connecting to host 10.254.100.100, port 5201
|
|
|
|
|
iperf Done.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//TODO: NEED TO UPDATE WINDOWS IMPLEMENTATION ALSO!!!!!
|
|
|
|
|
func (r *Reporter) runLogProcessor() {
|
|
|
|
|
tailer, err := tail.TailFile(r.LogFile, tail.Config{
|
|
|
|
|
var err error
|
|
|
|
|
r.tailer, err = tail.TailFile(r.LogFile, tail.Config{
|
|
|
|
|
Follow: true,
|
|
|
|
|
ReOpen: true,
|
|
|
|
|
Poll: true, // on linux we don't need to poll as the fsnotify works properly
|
|
|
|
@ -55,8 +57,13 @@ func (r *Reporter) runLogProcessor() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatalf("failed to tail log file: %v", err)
|
|
|
|
|
}
|
|
|
|
|
for line := range tailer.Lines {
|
|
|
|
|
// TODO: For now this only cares about individual streams it ignores the sum lines
|
|
|
|
|
|
|
|
|
|
for {
|
|
|
|
|
select {
|
|
|
|
|
case line := <- r.tailer.Lines:
|
|
|
|
|
if line == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
if len(line.Text) > 5 {
|
|
|
|
|
id := line.Text[1:4]
|
|
|
|
|
stream, err := strconv.Atoi(strings.TrimSpace(id))
|
|
|
|
@ -113,11 +120,10 @@ func (r *Reporter) runLogProcessor() {
|
|
|
|
|
r.ReportingChannel <- report
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case <- time.After(1 * time.Second):
|
|
|
|
|
if !r.running {
|
|
|
|
|
fmt.Println("reporter is finished. exiting")
|
|
|
|
|
close(r.ReportingChannel)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|