()
| 106 | } |
| 107 | |
| 108 | func (pool *PeerPool) getActivePeerCount() int { |
| 109 | pool.lock.RLock() |
| 110 | defer pool.lock.RUnlock() |
| 111 | |
| 112 | n := 0 |
| 113 | for _, p := range pool.peers { |
| 114 | if p.connected { |
| 115 | n++ |
| 116 | } |
| 117 | } |
| 118 | return n |
| 119 | } |
| 120 | |
| 121 | func (pool *PeerPool) waitPeerConnected(peerIdx uint32) { |
| 122 | if !pool.isNewPeer(peerIdx) { |
no outgoing calls