func (t *Torrent) numTotalPeers() int {
	peers := make(map[string]struct{})
	for conn := range t.conns {
		ra := conn.conn.RemoteAddr()
		if ra == nil {
			// It's been closed and doesn't support RemoteAddr.
			continue
		}
		peers[ra.String()] = struct{}{}
	}
	for addr := range t.halfOpen {
		peers[addr] = struct{}{}
	}
	t.peers.Each(func(peer Peer) {
		peers[peer.Addr.String()] = struct{}{}
	})
	return len(peers)
}
// The total number of peers in the torrent.
The total number of peers in the torrent.
// The total number of peers in the torrent .
func (t *Torrent) numTotalPeers() int {
	peers := make(map[string]struct{})
	for conn := range t.conns {
		ra := conn.conn.RemoteAddr()
		if ra == nil {
			continue
		}
		peers[ra.String()] = struct{}{}
	}
	for addr := range t.halfOpen {
		peers[addr] = struct{}{}
	}
	t.peers.Each(func(peer Peer) {
		peers[peer.Addr.String()] = struct{}{}
	})
	return len(peers)
}
func ( t * Torrent ) numTotalPeers ( ) int { peers := make ( map [ string ] struct { } ) for conn := range t . conns { ra := conn . conn . RemoteAddr ( ) if ra == nil { continue } peers [ ra . String ( ) ] = struct { } { } } for addr := range t . halfOpen { peers [ addr ] = struct { } { } } t . peers . Each ( func ( peer Peer ) { peers [ peer . Addr . String ( ) ] = struct { } { } } ) return len ( peers ) }
The total number of peers in the torrent.
The total number of peers in the torrent .
// It's been closed and doesn't support RemoteAddr.