localize ptInfo and iceServers vars, separate copy-paste helpers, move some logging

to more sensible locations
This commit is contained in:
Serene Han 2016-06-12 11:49:32 -07:00
parent b6f15a8d5c
commit fedb124313
4 changed files with 41 additions and 38 deletions

View file

@ -17,7 +17,9 @@ type WebRTCDialer struct {
webrtcConfig *webrtc.Configuration
}
func NewWebRTCDialer(broker *BrokerChannel) *WebRTCDialer {
func NewWebRTCDialer(
broker *BrokerChannel, iceServers IceServerList) *WebRTCDialer {
config := webrtc.NewConfiguration(iceServers...)
return &WebRTCDialer{
BrokerChannel: broker,
@ -32,8 +34,7 @@ func (w WebRTCDialer) Catch() (*webRTCConn, error) {
}
// TODO: [#3] Fetch ICE server information from Broker.
// TODO: [#18] Consider TURN servers here too.
config := webrtc.NewConfiguration(iceServers...)
connection := NewWebRTCConnection(config, w.BrokerChannel)
connection := NewWebRTCConnection(w.webrtcConfig, w.BrokerChannel)
err := connection.Connect()
return connection, err
}