Use chan struct{} instead of chan bool in openChan.

http://dave.cheney.net/2014/03/25/the-empty-struct
"...there is one important practical use of empty structs, and that is
the chan struct{} construct used for signaling between go routines"
This commit is contained in:
David Fifield 2016-01-18 03:04:39 -08:00
parent 48db4ac132
commit a77ae6b771

View file

@ -104,7 +104,7 @@ func dialWebRTC(config *webrtc.Configuration, meek *MeekChannel) (
offerChan := make(chan *webrtc.SessionDescription) offerChan := make(chan *webrtc.SessionDescription)
errChan := make(chan error) errChan := make(chan error)
openChan := make(chan bool) openChan := make(chan struct{})
pc, err := webrtc.NewPeerConnection(config) pc, err := webrtc.NewPeerConnection(config)
if err != nil { if err != nil {
@ -151,7 +151,7 @@ func dialWebRTC(config *webrtc.Configuration, meek *MeekChannel) (
} }
dc.OnOpen = func() { dc.OnOpen = func() {
log.Println("OnOpen channel") log.Println("OnOpen channel")
openChan <- true openChan <- struct{}{}
} }
dc.OnClose = func() { dc.OnClose = func() {
log.Println("OnClose channel") log.Println("OnClose channel")