Remove user snatches (should be handled by backend)
This commit is contained in:
parent
24b4437edd
commit
14fd5612af
4 changed files with 0 additions and 23 deletions
|
@ -171,14 +171,6 @@ func handleEvent(c Conn, ann *models.Announce) (snatched bool, err error) {
|
||||||
}
|
}
|
||||||
ann.Torrent.Snatches++
|
ann.Torrent.Snatches++
|
||||||
}
|
}
|
||||||
|
|
||||||
if snatched && ann.Config.PrivateEnabled {
|
|
||||||
err = c.IncrementUserSnatches(ann.User.Passkey)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ann.User.Snatches++
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,6 @@ type Conn interface {
|
||||||
FindUser(passkey string) (*models.User, error)
|
FindUser(passkey string) (*models.User, error)
|
||||||
PutUser(u *models.User) error
|
PutUser(u *models.User) error
|
||||||
DeleteUser(passkey string) error
|
DeleteUser(passkey string) error
|
||||||
IncrementUserSnatches(passkey string) error
|
|
||||||
|
|
||||||
// Whitelist interactions
|
// Whitelist interactions
|
||||||
FindClient(clientID string) error
|
FindClient(clientID string) error
|
||||||
|
|
|
@ -67,19 +67,6 @@ func (c *Conn) IncrementTorrentSnatches(infohash string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Conn) IncrementUserSnatches(userID string) error {
|
|
||||||
c.usersM.Lock()
|
|
||||||
defer c.usersM.Unlock()
|
|
||||||
|
|
||||||
u, exists := c.users[userID]
|
|
||||||
if !exists {
|
|
||||||
return models.ErrUserDNE
|
|
||||||
}
|
|
||||||
u.Snatches++
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Conn) TouchTorrent(infohash string) error {
|
func (c *Conn) TouchTorrent(infohash string) error {
|
||||||
c.torrentsM.Lock()
|
c.torrentsM.Lock()
|
||||||
defer c.torrentsM.Unlock()
|
defer c.torrentsM.Unlock()
|
||||||
|
|
|
@ -169,7 +169,6 @@ type User struct {
|
||||||
|
|
||||||
UpMultiplier float64 `json:"up_multiplier"`
|
UpMultiplier float64 `json:"up_multiplier"`
|
||||||
DownMultiplier float64 `json:"down_multiplier"`
|
DownMultiplier float64 `json:"down_multiplier"`
|
||||||
Snatches uint64 `json:"snatches"` // TODO deleteme
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Announce is an Announce by a Peer.
|
// Announce is an Announce by a Peer.
|
||||||
|
|
Loading…
Add table
Reference in a new issue