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

@ -38,6 +38,7 @@ func NewPeers(max int) *Peers {
// As part of |SnowflakeCollector| interface.
func (p *Peers) Collect() error {
cnt := p.Count()
if cnt >= p.capacity {
s := fmt.Sprintf("At capacity [%d/%d]", cnt, p.capacity)
@ -59,6 +60,7 @@ func (p *Peers) Collect() error {
// As part of |SnowflakeCollector| interface.
func (p *Peers) Pop() *webRTCConn {
// Blocks until an available snowflake appears.
snowflake, ok := <-p.snowflakeChan
if !ok {