mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-14 06:08:36 -07:00
Clearer field names for the Tracker struct
This commit is contained in:
@@ -24,7 +24,7 @@ func (t *Tracker) ServeAnnounce(w http.ResponseWriter, r *http.Request, p httpro
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func (t *Tracker) ServeAnnounce(w http.ResponseWriter, r *http.Request, p httpro
|
||||
|
||||
if t.cfg.Private {
|
||||
delta := models.NewAnnounceDelta(ann, peer, user, torrent, created, snatched)
|
||||
err = t.bc.RecordAnnounce(delta)
|
||||
err = t.backend.RecordAnnounce(delta)
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestPrivateAnnounce(t *testing.T) {
|
||||
}
|
||||
|
||||
func loadTestData(tkr *Tracker) error {
|
||||
conn, err := tkr.tp.Get()
|
||||
conn, err := tkr.pool.Get()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
16
http/api.go
16
http/api.go
@@ -26,7 +26,7 @@ func (t *Tracker) check(w http.ResponseWriter, r *http.Request, p httprouter.Par
|
||||
}
|
||||
|
||||
func (t *Tracker) getTorrent(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func (t *Tracker) putTorrent(w http.ResponseWriter, r *http.Request, p httproute
|
||||
return http.StatusBadRequest, err
|
||||
}
|
||||
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func (t *Tracker) putTorrent(w http.ResponseWriter, r *http.Request, p httproute
|
||||
}
|
||||
|
||||
func (t *Tracker) delTorrent(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func (t *Tracker) delTorrent(w http.ResponseWriter, r *http.Request, p httproute
|
||||
}
|
||||
|
||||
func (t *Tracker) getUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
@@ -134,7 +134,7 @@ func (t *Tracker) putUser(w http.ResponseWriter, r *http.Request, p httprouter.P
|
||||
return http.StatusBadRequest, err
|
||||
}
|
||||
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
@@ -148,7 +148,7 @@ func (t *Tracker) putUser(w http.ResponseWriter, r *http.Request, p httprouter.P
|
||||
}
|
||||
|
||||
func (t *Tracker) delUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
@@ -164,7 +164,7 @@ func (t *Tracker) delUser(w http.ResponseWriter, r *http.Request, p httprouter.P
|
||||
}
|
||||
|
||||
func (t *Tracker) putClient(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
@@ -178,7 +178,7 @@ func (t *Tracker) putClient(w http.ResponseWriter, r *http.Request, p httprouter
|
||||
}
|
||||
|
||||
func (t *Tracker) delClient(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) {
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
12
http/http.go
12
http/http.go
@@ -20,9 +20,9 @@ import (
|
||||
)
|
||||
|
||||
type Tracker struct {
|
||||
cfg *config.Config
|
||||
tp tracker.Pool
|
||||
bc backend.Conn
|
||||
cfg *config.Config
|
||||
pool tracker.Pool
|
||||
backend backend.Conn
|
||||
}
|
||||
|
||||
func NewTracker(cfg *config.Config) (*Tracker, error) {
|
||||
@@ -37,9 +37,9 @@ func NewTracker(cfg *config.Config) (*Tracker, error) {
|
||||
}
|
||||
|
||||
return &Tracker{
|
||||
cfg: cfg,
|
||||
tp: tp,
|
||||
bc: bc,
|
||||
cfg: cfg,
|
||||
pool: tp,
|
||||
backend: bc,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ func (t *Tracker) ServeScrape(w http.ResponseWriter, r *http.Request, p httprout
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
conn, err := t.tp.Get()
|
||||
conn, err := t.pool.Get()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user