fix merge conflict

main
Ben Grewell 3 years ago
commit 698ed48ff0

@ -8,8 +8,8 @@
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client.go" beforeDir="false" afterPath="$PROJECT_DIR$/client.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/main.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/execute.go" beforeDir="false" afterPath="$PROJECT_DIR$/execute.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/server.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/shared.go" beforeDir="false" afterPath="$PROJECT_DIR$/shared.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -24,7 +24,7 @@
</list>
</option>
</component>
<component name="GOROOT" url="file:///usr/local/go" />
<component name="GOROOT" url="file://$PROJECT_DIR$/../../../../../Program Files/Go" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -58,59 +58,59 @@
<recent name="C:\Users\BGrewell\repos\go-iperf\embedded" />
</key>
</component>
<component name="RunManager" selected="Go Build.go build github.com/BGrewell/go-iperf/tests/controller">
<component name="RunManager" selected="Go Build.go build github.com/BGrewell/go-iperf/cmd">
<configuration name="go build github.com/BGrewell/go-iperf/cmd" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="go-iperf" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/cmd/main.go" />
<package value="github.com/BGrewell/go-iperf/cmd" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$/cmd/main.go" />
<method v="2" />
</configuration>
<configuration name="go build github.com/BGrewell/go-iperf/tests/client" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="go-iperf" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/tests/client/client.go" />
<package value="github.com/BGrewell/go-iperf/tests/client" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$/tests/client/client.go" />
<method v="2" />
</configuration>
<configuration name="go build github.com/BGrewell/go-iperf/tests/controller" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="go-iperf" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/tests/controller/main.go" />
<package value="github.com/BGrewell/go-iperf/tests/controller" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$/tests/controller/main.go" />
<method v="2" />
</configuration>
<configuration name="go build github.com/BGrewell/go-iperf/tests/extract" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="go-iperf" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/tests/extract/main.go" />
<package value="github.com/BGrewell/go-iperf/tests/extract" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$/tests/extract/main.go" />
<method v="2" />
</configuration>
<configuration name="go build github.com/BGrewell/go-iperf/tests/server" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="go-iperf" />
<working_directory value="$PROJECT_DIR$" />
<kind value="PACKAGE" />
<filePath value="$PROJECT_DIR$/tests/server/server.go" />
<package value="github.com/BGrewell/go-iperf/tests/server" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$/tests/server/server.go" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Go Build.go build github.com/BGrewell/go-iperf/cmd" />
<item itemvalue="Go Build.go build github.com/BGrewell/go-iperf/tests/controller" />
<item itemvalue="Go Build.go build github.com/BGrewell/go-iperf/tests/extract" />
<item itemvalue="Go Build.go build github.com/BGrewell/go-iperf/tests/client" />
<item itemvalue="Go Build.go build github.com/BGrewell/go-iperf/tests/server" />
<item itemvalue="Go Build.go build github.com/BGrewell/go-iperf/cmd" />
</list>
</recent_temporary>
</component>
@ -131,4 +131,4 @@
<component name="VgoProject">
<integration-enabled>true</integration-enabled>
</component>
</project>
</project>

@ -489,18 +489,31 @@ func (c *Client) SetModeLive() <-chan *StreamIntervalReport {
}
func (c *Client) Start() (err error) {
_, err = c.start()
return err
}
func (c *Client) StartEx() (pid int, err error) {
return c.start()
}
func (c *Client) start() (pid int, err error) {
read := make(chan interface{})
cmd, err := c.commandString()
if err != nil {
return err
return -1, err
}
var exit chan int
<<<<<<< HEAD
if c.Debug {
fmt.Printf("executing command: %s\n", cmd)
}
c.outputStream, c.errorStream, exit, c.cancel, err = ExecuteAsyncWithCancelReadIndicator(cmd, read)
=======
c.outputStream, c.errorStream, exit, c.cancel, pid, err = ExecuteAsyncWithCancelReadIndicator(cmd, read)
>>>>>>> 328913249f87399ed1ce133fec58df85a24aa9b0
if err != nil {
return err
return -1, err
}
c.Running = true
@ -551,7 +564,7 @@ func (c *Client) Start() (err error) {
reporter.Stop()
}
}()
return nil
return pid, nil
}
func (c *Client) Stop() {

@ -2,11 +2,14 @@ package main
import (
//"fmt"
//"github.com/BGrewell/go-conversions"
"github.com/BGrewell/go-conversions"
//"github.com/BGrewell/go-iperf"
//"time"
"fmt"
<<<<<<< HEAD
"github.com/BGrewell/go-conversions"
=======
>>>>>>> 328913249f87399ed1ce133fec58df85a24aa9b0
"github.com/BGrewell/go-iperf"
"time"
)

@ -29,12 +29,6 @@ func NewController(port int) (controller *Controller, err error) {
// server side it listens for new gRPC connections, when a connection is made by a client the client can tell it to
// start a new iperf server instance. It will start a instance on an unused port and return the port number to the
// client. This allows the entire iperf setup and session to be performed from the client side.
//
// CLIENT SERVER
// connect to grpc ---> accept grpc connection
// call StartServer() ---> find unused port
// start iperf server on port
// get server port info <--- return port information to client
type Controller struct {
api.UnimplementedCommandServer
Port int

@ -42,34 +42,38 @@ func ExecuteAsync(cmd string) (outPipe io.ReadCloser, errPipe io.ReadCloser, exi
return outPipe, errPipe, exitCode, nil
}
func ExecuteAsyncWithCancel(cmd string) (stdOut io.ReadCloser, stdErr io.ReadCloser, exitCode chan int, cancelToken context.CancelFunc, err error) {
func ExecuteAsyncWithCancel(cmd string) (stdOut io.ReadCloser, stdErr io.ReadCloser, exitCode chan int, cancelToken context.CancelFunc, pid int, err error) {
return ExecuteAsyncWithCancelReadIndicator(cmd, nil)
}
func ExecuteAsyncWithCancelReadIndicator(cmd string, readIndicator chan interface{}) (stdOut io.ReadCloser, stdErr io.ReadCloser, exitCode chan int, cancelToken context.CancelFunc, err error) {
func ExecuteAsyncWithCancelReadIndicator(cmd string, readIndicator chan interface{}) (stdOut io.ReadCloser, stdErr io.ReadCloser, exitCode chan int, cancelToken context.CancelFunc, pid int, err error) {
return executeAsyncWithCancel(cmd, readIndicator)
}
func executeAsyncWithCancel(cmd string, readIndicator chan interface{}) (stdOut io.ReadCloser, stdErr io.ReadCloser, exitCode chan int, cancelToken context.CancelFunc, pid int, err error) {
exitCode = make(chan int)
ctx, cancel := context.WithCancel(context.Background())
cmdParts := strings.Fields(cmd)
binary, err := exec.LookPath(cmdParts[0])
if err != nil {
defer cancel()
return nil, nil, nil, nil, err
return nil, nil, nil, nil, -1, err
}
exe := exec.CommandContext(ctx, binary, cmdParts[1:]...)
stdOut, err = exe.StdoutPipe()
if err != nil {
defer cancel()
return nil, nil, nil, nil, err
return nil, nil, nil, nil, -1, err
}
stdErr, err = exe.StderrPipe()
if err != nil {
defer cancel()
return nil, nil, nil, nil, err
return nil, nil, nil, nil, -1, err
}
err = exe.Start()
if err != nil {
defer cancel()
return nil, nil, nil, nil, err
return nil, nil, nil, nil, -1, err
}
go func() {
// Note: Wait() will close the Stdout/Stderr and in some cases can do it before we read. In order to prevent
@ -87,5 +91,5 @@ func ExecuteAsyncWithCancelReadIndicator(cmd string, readIndicator chan interfac
exitCode <- 0
}
}()
return stdOut, stdErr, exitCode, cancel, nil
}
return stdOut, stdErr, exitCode, cancel, exe.Process.Pid, nil
}

@ -10,6 +10,11 @@ import (
"time"
)
<<<<<<< HEAD
//TODO: This has not been tested on OS X ... my assumption is it is the exact same as linux but if it's not then the
// reporting will be broken
=======
/*
Connecting to host 10.254.100.100, port 5201
[ 4] local 192.168.3.182 port 54104 connected to 10.254.100.100 port 5201
@ -45,6 +50,7 @@ Connecting to host 10.254.100.100, port 5201
iperf Done.
*/
>>>>>>> 8ad71c4c5699a6d55965c2f1ab99d5c306295c3b
func (r *Reporter) runLogProcessor() {
var err error
r.tailer, err = tail.TailFile(r.LogFile, tail.Config{

@ -151,17 +151,30 @@ func (s *Server) SetLogFile(filename string) {
}
func (s *Server) Start() (err error) {
_, err = s.start()
return err
}
func (s *Server) StartEx() (pid int, err error) {
return s.start()
}
func (s *Server) start() (pid int, err error) {
cmd, err := s.commandString()
if err != nil {
return err
return -1, err
}
var exit chan int
<<<<<<< HEAD
if s.Debug {
fmt.Printf("executing command: %s\n", cmd)
}
s.outputStream, s.errorStream, exit, s.cancel, err = ExecuteAsyncWithCancel(cmd)
=======
s.outputStream, s.errorStream, exit, s.cancel, pid, err = ExecuteAsyncWithCancel(cmd)
>>>>>>> 328913249f87399ed1ce133fec58df85a24aa9b0
if err != nil {
return err
return -1, err
}
s.Running = true
@ -179,7 +192,7 @@ func (s *Server) Start() (err error) {
s.ExitCode = &exitCode
s.Running = false
}()
return nil
return pid,nil
}
func (s *Server) Stop() {

Loading…
Cancel
Save