mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-17 01:49:45 -07:00
Return PeerMap by reference.
In accordance with `go vet`, locks should only be returned by reference.
This commit is contained in:
@@ -96,8 +96,8 @@ type Torrent struct {
|
||||
ID uint64 `json:"id"`
|
||||
Infohash string `json:"infohash"`
|
||||
|
||||
Seeders PeerMap `json:"seeders"`
|
||||
Leechers PeerMap `json:"leechers"`
|
||||
Seeders *PeerMap `json:"seeders"`
|
||||
Leechers *PeerMap `json:"leechers"`
|
||||
|
||||
Snatches uint64 `json:"snatches"`
|
||||
UpMultiplier float64 `json:"up_multiplier"`
|
||||
|
||||
@@ -24,8 +24,8 @@ type PeerMap struct {
|
||||
}
|
||||
|
||||
// NewPeerMap initializes the map for a new PeerMap.
|
||||
func NewPeerMap(seeders bool, cfg *config.Config) PeerMap {
|
||||
pm := PeerMap{
|
||||
func NewPeerMap(seeders bool, cfg *config.Config) *PeerMap {
|
||||
pm := &PeerMap{
|
||||
Peers: make(map[string]map[PeerKey]Peer),
|
||||
Seeders: seeders,
|
||||
Config: cfg.NetConfig.SubnetConfig,
|
||||
|
||||
Reference in New Issue
Block a user