Skip to content

Commit f7ac26a

Browse files
authored
Merge branch 'master' into debugLogger
2 parents 8c16239 + acc342f commit f7ac26a

File tree

3 files changed

+42
-17
lines changed

3 files changed

+42
-17
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Check out the **[contributing wiki](https://github.com/pions/webrtc/wiki/Contrib
7070
* [Jake B](https://github.com/silbinarywolf) - *Fix Windows installation instructions*
7171
* [Michael MacDonald](https://github.com/mjmac)
7272
* [Oleg Kovalov](https://github.com/cristaloleg) *Use wildcards instead of hardcoding travis-ci config*
73-
* [Woodrow Douglass](https://github.com/wdouglass) *RTCP, RTP improvements*
73+
* [Woodrow Douglass](https://github.com/wdouglass) *RTCP, RTP improvements, G.722 support, Bugfixes*
7474
* [Tobias Fridén](https://github.com/tobiasfriden) *SRTP authentication verification*
7575

7676
### License

pkg/ice/agent.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -640,11 +640,18 @@ func (a *Agent) getBestPair() (*candidatePair, error) {
640640
res <- p
641641
return
642642
}
643+
res <- nil
643644
})
644645

645646
if err != nil {
646647
return nil, err
647648
}
648649

649-
return <-res, nil
650+
out := <-res
651+
652+
if out == nil {
653+
return nil, errors.New("No Valid Candidate Pairs Available")
654+
}
655+
656+
return out, nil
650657
}

pkg/ice/agent_test.go

+33-15
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,40 @@ package ice
22

33
import (
44
"testing"
5+
"time"
6+
7+
"github.com/pions/transport/test"
58
)
69

7-
func TestTimeConsuming(t *testing.T) {
8-
if testing.Short() {
9-
t.Skip("skipping test in short mode.")
10+
func TestPairSearch(t *testing.T) {
11+
// Limit runtime in case of deadlocks
12+
lim := test.TimeOut(time.Second * 10)
13+
defer lim.Stop()
14+
15+
var config AgentConfig
16+
a, err := NewAgent(&config)
17+
18+
if err != nil {
19+
t.Fatalf("Error constructing ice.Agent")
1020
}
11-
}
1221

13-
// func ExampleNew() {
14-
// m := New("a", "a", "b")
15-
// var list []string
16-
// for elem := range m.Iter() {
17-
// list = append(list, elem.(string))
18-
// }
19-
// sort.Strings(list)
20-
// fmt.Println(list)
21-
// Output:
22-
// [a a b]
23-
// }
22+
if len(a.validPairs) != 0 {
23+
t.Fatalf("TestPairSearch is only a valid test if a.validPairs is empty on construction")
24+
}
25+
26+
cp, err := a.getBestPair()
27+
28+
if cp != nil {
29+
t.Fatalf("No Candidate pairs should exist")
30+
}
31+
32+
if err == nil {
33+
t.Fatalf("An error should have been reported (with no available candidate pairs)")
34+
}
35+
36+
err = a.Close()
37+
38+
if err != nil {
39+
t.Fatalf("Close agent emits error %v", err)
40+
}
41+
}

0 commit comments

Comments
 (0)