Return PeerMap by reference.
In accordance with `go vet`, locks should only be returned by reference.
This commit is contained in:
parent
d46beb0f7d
commit
d754b5b376
2 changed files with 4 additions and 4 deletions
|
@ -96,8 +96,8 @@ type Torrent struct {
|
||||||
ID uint64 `json:"id"`
|
ID uint64 `json:"id"`
|
||||||
Infohash string `json:"infohash"`
|
Infohash string `json:"infohash"`
|
||||||
|
|
||||||
Seeders PeerMap `json:"seeders"`
|
Seeders *PeerMap `json:"seeders"`
|
||||||
Leechers PeerMap `json:"leechers"`
|
Leechers *PeerMap `json:"leechers"`
|
||||||
|
|
||||||
Snatches uint64 `json:"snatches"`
|
Snatches uint64 `json:"snatches"`
|
||||||
UpMultiplier float64 `json:"up_multiplier"`
|
UpMultiplier float64 `json:"up_multiplier"`
|
||||||
|
|
|
@ -24,8 +24,8 @@ type PeerMap struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPeerMap initializes the map for a new PeerMap.
|
// NewPeerMap initializes the map for a new PeerMap.
|
||||||
func NewPeerMap(seeders bool, cfg *config.Config) PeerMap {
|
func NewPeerMap(seeders bool, cfg *config.Config) *PeerMap {
|
||||||
pm := PeerMap{
|
pm := &PeerMap{
|
||||||
Peers: make(map[string]map[PeerKey]Peer),
|
Peers: make(map[string]map[PeerKey]Peer),
|
||||||
Seeders: seeders,
|
Seeders: seeders,
|
||||||
Config: cfg.NetConfig.SubnetConfig,
|
Config: cfg.NetConfig.SubnetConfig,
|
||||||
|
|
Loading…
Add table
Reference in a new issue