diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1639a5b..b9bbea8 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,7 +7,9 @@
-
+
+
+
diff --git a/client.go b/client.go
index 58ec83e..d2d1db5 100644
--- a/client.go
+++ b/client.go
@@ -495,6 +495,9 @@ func (c *Client) Start() (err error) {
return err
}
var exit chan int
+ if c.Debug {
+ fmt.Printf("executing command: %s\n", cmd)
+ }
c.outputStream, c.errorStream, exit, c.cancel, err = ExecuteAsyncWithCancelReadIndicator(cmd, read)
if err != nil {
return err
diff --git a/cmd/main.go b/cmd/main.go
index c2ea8fb..69e02a7 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -5,42 +5,45 @@ import (
//"github.com/BGrewell/go-conversions"
//"github.com/BGrewell/go-iperf"
//"time"
+ "fmt"
+ "github.com/BGrewell/go-conversions"
+ "github.com/BGrewell/go-iperf"
+ "time"
)
func main() {
- //s := iperf.NewServer()
- //c := iperf.NewClient("127.0.0.1")
- //includeServer := true
- //c.IncludeServer = &includeServer
- //fmt.Println(s.Id)
- //fmt.Println(c.Id)
- //
- //err := s.Start()
- //if err != nil {
- // fmt.Println(err)
- //}
- //
- //err = c.Start()
- //if err != nil {
- // fmt.Println(err)
- //}
- //
- //for c.Running {
- // time.Sleep(1 * time.Second)
- //}
- //
- //fmt.Println("stopping server")
- //s.Stop()
- //
- //fmt.Printf("Client exit code: %d\n", *c.ExitCode)
- //fmt.Printf("Server exit code: %d\n", *s.ExitCode)
- //iperf.Cleanup()
- //if c.Report.Error != "" {
- // fmt.Println(c.Report.Error)
- //} else {
- // fmt.Printf("Recv Rate: %s\n", conversions.IntBitRateToString(int64(c.Report.End.SumReceived.BitsPerSecond)))
- // fmt.Printf("Send Rate: %s\n", conversions.IntBitRateToString(int64(c.Report.End.SumSent.BitsPerSecond)))
- //}
+ s := iperf.NewServer()
+ c := iperf.NewClient("127.0.0.1")
+ c.SetIncludeServer(true)
+ fmt.Println(s.Id)
+ fmt.Println(c.Id)
+
+ err := s.Start()
+ if err != nil {
+ fmt.Println(err)
+ }
+
+ err = c.Start()
+ if err != nil {
+ fmt.Println(err)
+ }
+
+ for c.Running {
+ time.Sleep(1 * time.Second)
+ }
+
+ fmt.Println("stopping server")
+ s.Stop()
+
+ fmt.Printf("Client exit code: %d\n", *c.ExitCode())
+ fmt.Printf("Server exit code: %d\n", *s.ExitCode)
+ iperf.Cleanup()
+ if c.Report().Error != "" {
+ fmt.Println(c.Report().Error)
+ } else {
+ fmt.Printf("Recv Rate: %s\n", conversions.IntBitRateToString(int64(c.Report().End.SumReceived.BitsPerSecond)))
+ fmt.Printf("Send Rate: %s\n", conversions.IntBitRateToString(int64(c.Report().End.SumSent.BitsPerSecond)))
+ }
}
diff --git a/reporter_linux.go b/reporter_linux.go
index f00bfe8..40f0f31 100644
--- a/reporter_linux.go
+++ b/reporter_linux.go
@@ -56,9 +56,6 @@ func (r *Reporter) runLogProcessor() {
if err != nil {
log.Fatalf("failed to tail log file: %v", err)
}
- if DEBUG {
- log.Printf("starting to watch log file: %s\n", r.LogFile)
- }
for {
select {
@@ -66,16 +63,10 @@ func (r *Reporter) runLogProcessor() {
if line == nil {
continue
}
- if DEBUG {
- log.Printf("new line: %s\n", line)
- }
if len(line.Text) > 5 {
id := line.Text[1:4]
stream, err := strconv.Atoi(strings.TrimSpace(id))
if err != nil {
- if DEBUG {
- log.Printf("error converting stream id to int: %v\n", err)
- }
continue
}
fields := strings.Fields(line.Text[5:])
@@ -126,9 +117,6 @@ func (r *Reporter) runLogProcessor() {
Omitted: omitted,
}
r.ReportingChannel <- report
- if DEBUG {
- log.Println("added report to reporting channel")
- }
}
}
case <-time.After(100 * time.Millisecond):
diff --git a/server.go b/server.go
index e3a11ff..638a225 100644
--- a/server.go
+++ b/server.go
@@ -156,6 +156,9 @@ func (s *Server) Start() (err error) {
return err
}
var exit chan int
+ if s.Debug {
+ fmt.Printf("executing command: %s\n", cmd)
+ }
s.outputStream, s.errorStream, exit, s.cancel, err = ExecuteAsyncWithCancel(cmd)
if err != nil {
return err
diff --git a/shared.go b/shared.go
index 2190bc0..6934e6d 100644
--- a/shared.go
+++ b/shared.go
@@ -6,10 +6,6 @@ import (
"io"
)
-var (
- DEBUG = false
-)
-
type TestMode string
const (