mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-13 16:23:33 -07:00
Introduce thread-safe PeerMap
This commit is contained in:
@@ -374,8 +374,8 @@ func loadPrivateTestData(tkr *tracker.Tracker) error {
|
||||
torrent := &models.Torrent{
|
||||
ID: 1,
|
||||
Infohash: infoHash,
|
||||
Seeders: models.PeerMap{},
|
||||
Leechers: models.PeerMap{},
|
||||
Seeders: models.NewPeerMap(),
|
||||
Leechers: models.NewPeerMap(),
|
||||
}
|
||||
|
||||
return conn.PutTorrent(torrent)
|
||||
|
||||
+2
-2
@@ -111,8 +111,8 @@ func filesDict(torrents []*models.Torrent) bencode.Dict {
|
||||
|
||||
func torrentDict(torrent *models.Torrent) bencode.Dict {
|
||||
return bencode.Dict{
|
||||
"complete": len(torrent.Seeders),
|
||||
"incomplete": len(torrent.Leechers),
|
||||
"complete": torrent.Seeders.Len(),
|
||||
"incomplete": torrent.Leechers.Len(),
|
||||
"downloaded": torrent.Snatches,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user