Clearer field names for the Tracker struct

This commit is contained in:
Justin Li 2014-07-16 11:29:40 -04:00
parent 2972aae231
commit d39a40c4fe
5 changed files with 18 additions and 18 deletions

View file

@ -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
}

View file

@ -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
}

View file

@ -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
}

View file

@ -21,8 +21,8 @@ import (
type Tracker struct {
cfg *config.Config
tp tracker.Pool
bc backend.Conn
pool tracker.Pool
backend backend.Conn
}
func NewTracker(cfg *config.Config) (*Tracker, error) {
@ -38,8 +38,8 @@ func NewTracker(cfg *config.Config) (*Tracker, error) {
return &Tracker{
cfg: cfg,
tp: tp,
bc: bc,
pool: tp,
backend: bc,
}, nil
}

View file

@ -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
}