Skip to content

Commit

Permalink
- Adding missing close sender, receiver connection. This should now e…
Browse files Browse the repository at this point in the history
…xit receiver on finish
  • Loading branch information
emiago committed Aug 9, 2020
1 parent 631c9e5 commit ff22683
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions cli/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func receiveFiles() {
if err := r.Dial(); err != nil {
log.Fatal(err)
}
defer r.Close()

wg.Wait()
}
2 changes: 1 addition & 1 deletion cli/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func sendFiles(args []string, keepsync bool) error {
if err := s.Dial(); err != nil {
return errx.Wrapf(err, "Dial failed")
}
// defer s.Close()
defer s.Close()

//Stream files
fmt.Println("")
Expand Down
8 changes: 8 additions & 0 deletions streamer/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ func NewSession(SDPReader io.Reader, SDPWriter io.Writer) Session {
return sess
}

func (s *Session) Close() error {
if s.peerConnection != nil {
return s.peerConnection.Close()
}

return nil
}

// CreateConnection prepares a WebRTC connection
func (s *Session) CreateConnection(onConnectionStateChange func(connectionState webrtc.ICEConnectionState)) error {
config := webrtc.Configuration{
Expand Down

0 comments on commit ff22683

Please sign in to comment.