mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-18 06:08:10 -07:00
nickpicking
This commit is contained in:
+9
-9
@@ -5,12 +5,12 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
type Peer struct {
|
type Peer struct {
|
||||||
Id string
|
ID string
|
||||||
UserId uint64
|
UserID uint64
|
||||||
TorrentId uint64
|
TorrentID uint64
|
||||||
|
|
||||||
Port uint
|
Port uint
|
||||||
Ip string
|
IP string
|
||||||
Addr []byte
|
Addr []byte
|
||||||
|
|
||||||
Uploaded uint64
|
Uploaded uint64
|
||||||
@@ -18,13 +18,13 @@ type Peer struct {
|
|||||||
Left uint64
|
Left uint64
|
||||||
Seeding bool
|
Seeding bool
|
||||||
|
|
||||||
StartTime int64 // Unix Timestamp
|
StartTimeUnix int64
|
||||||
LastAnnounce int64
|
LastAnnounce int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Torrent struct {
|
type Torrent struct {
|
||||||
Id uint64
|
ID uint64
|
||||||
InfoHash string
|
Infohash string
|
||||||
UpMultiplier float64
|
UpMultiplier float64
|
||||||
DownMultiplier float64
|
DownMultiplier float64
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ type Torrent struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
Id uint64
|
ID uint64
|
||||||
Passkey string
|
Passkey string
|
||||||
UpMultiplier float64
|
UpMultiplier float64
|
||||||
DownMultiplier float64
|
DownMultiplier float64
|
||||||
|
|||||||
@@ -85,12 +85,12 @@ func (c *Conn) FindUser(passkey string) (*storage.User, bool, error) {
|
|||||||
|
|
||||||
reply, err := redis.Values(conn.Do("HGETALL", key))
|
reply, err := redis.Values(conn.Do("HGETALL", key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, true, err
|
||||||
}
|
}
|
||||||
user := &storage.User{}
|
user := &storage.User{}
|
||||||
err = redis.ScanStruct(reply, user)
|
err = redis.ScanStruct(reply, user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, true, err
|
||||||
}
|
}
|
||||||
return user, true, nil
|
return user, true, nil
|
||||||
}
|
}
|
||||||
@@ -111,12 +111,12 @@ func (c *Conn) FindTorrent(infohash string) (*storage.Torrent, bool, error) {
|
|||||||
|
|
||||||
reply, err := redis.Values(conn.Do("HGETALL", key))
|
reply, err := redis.Values(conn.Do("HGETALL", key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, true, err
|
||||||
}
|
}
|
||||||
torrent := &storage.Torrent{}
|
torrent := &storage.Torrent{}
|
||||||
err = redis.ScanStruct(reply, torrent)
|
err = redis.ScanStruct(reply, torrent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, true, err
|
||||||
}
|
}
|
||||||
return torrent, true, nil
|
return torrent, true, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user