Browse Source

Merge pull request #407 from fancycode/check_turnservice_urns_prio

Use TURN service URNs with lowest priority instead of first in list.
pull/413/head
Joachim Bauch 9 years ago committed by GitHub
parent
commit
87e5691b0c
  1. 14
      go/channelling/turnservice_manager.go

14
go/channelling/turnservice_manager.go

@ -100,9 +100,17 @@ func (mgr *turnServiceManager) turnData(credentials *turnservicecli.CachedCreden @@ -100,9 +100,17 @@ func (mgr *turnServiceManager) turnData(credentials *turnservicecli.CachedCreden
if len(turn.Servers) > 0 {
// For backwards compatibility with clients which do not
// understand turn.Servers, directly deliver the first TURN
// server zone URNs.
turn.Urls = turn.Servers[0].URNs
// understand turn.Servers, directly deliver the TURN
// server zone URNs with the lowest priority.
minPrio := 0
minPrioIdx := -1
for idx, server := range turn.Servers {
if minPrioIdx == -1 || server.Prio < minPrio {
minPrio = server.Prio
minPrioIdx = idx
}
}
turn.Urls = turn.Servers[minPrioIdx].URNs
}
}
}

Loading…
Cancel
Save