Reload server and edit configuration. ()

The first iteration for config editor and server reload from the web interface.
This commit is contained in:
Antonio Navarro Perez 2020-11-08 18:19:25 +01:00 committed by GitHub
parent 56d32fd1f4
commit 0e2288565d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 882 additions and 178 deletions

View file

@ -83,6 +83,13 @@ func (s *Torrent) Add(route string, t *torrent.Torrent) {
s.torrentsByRoute[route] = append(tbr, t)
}
func (s *Torrent) RemoveAll() {
// TODO lock
s.torrents = make(map[string]*torrent.Torrent)
s.previousStats = make(map[string]*stats)
s.torrentsByRoute = make(map[string][]*torrent.Torrent)
}
func (s *Torrent) Stats(hash string) (*TorrentStats, error) {
t, ok := s.torrents[hash]
if !(ok) {