Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
- Removed Download timeout on benchmark
- Improved UX
- Fixed benchmark alias
  • Loading branch information
Antonito committed Apr 2, 2019
1 parent 42eb50c commit 0d6c7fb
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/bench/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func New() cli.Command {
log.Traceln("Installing 'bench' command")
return cli.Command{
Name: "bench",
Aliases: []string{"sb"},
Aliases: []string{"b"},
Usage: "Benchmark the connexion",
Action: handler,
Flags: []cli.Flag{
Expand Down
2 changes: 2 additions & 0 deletions internal/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ func (s *Session) CreateConnection(onConnectionStateChange func(connectionState
// ReadSDP from the SDP input stream
func (s *Session) ReadSDP() error {
var sdp webrtc.SessionDescription

fmt.Println("Please, paste the remote SDP:")
for {
encoded, err := utils.MustReadStream(s.sdpInput)
if err == nil {
Expand Down
5 changes: 0 additions & 5 deletions pkg/session/bench/session.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package bench

import (
"fmt"

"github.com/pions/webrtc"
log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -40,7 +38,6 @@ func (s *Session) createMasterSession() error {
return err
}

fmt.Println("Please, paste the remote SDP:")
if err := s.sess.ReadSDP(); err != nil {
log.Errorln(err)
return err
Expand All @@ -49,13 +46,11 @@ func (s *Session) createMasterSession() error {
}

func (s *Session) createSlaveSession() error {
fmt.Println("Please, paste the remote SDP:")
if err := s.sess.ReadSDP(); err != nil {
log.Errorln(err)
return err
}

fmt.Println("SDP:")
if err := s.sess.CreateAnswer(); err != nil {
log.Errorln(err)
return err
Expand Down
7 changes: 0 additions & 7 deletions pkg/session/bench/state_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package bench

import (
"fmt"
"time"

"github.com/pions/webrtc"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -30,16 +29,10 @@ func (s *Session) onOpenHandlerDownload(dc *webrtc.DataChannel) func() {
log.Warningln("No DataChannel provided")
}

timeoutErr := time.After(s.testDurationError)

fmt.Printf("Downloading random datas ... (%d s)\n", int(s.testDuration.Seconds()))
DOWNLOAD_LOOP:
for {
select {
case <-timeoutErr:
log.Error("Download time'd out")
break DOWNLOAD_LOOP

case <-s.downloadDone:
log.Traceln("Done downloading")
break DOWNLOAD_LOOP
Expand Down

0 comments on commit 0d6c7fb

Please sign in to comment.