|
|
@@ -625,23 +625,18 @@ func (metadata Metadata) remainingLimitHeaderValues() (remainingDownloads, remai |
|
|
|
return remainingDownloads, remainingDays |
|
|
|
} |
|
|
|
|
|
|
|
func (s *Server) Lock(token, filename string) error { |
|
|
|
func (s *Server) Lock(token, filename string) { |
|
|
|
key := path.Join(token, filename) |
|
|
|
|
|
|
|
if _, ok := s.locks[key]; !ok { |
|
|
|
s.locks[key] = &sync.Mutex{} |
|
|
|
} |
|
|
|
|
|
|
|
s.locks[key].Lock() |
|
|
|
|
|
|
|
return nil |
|
|
|
lock, _ := s.locks.LoadOrStore(key, &sync.Mutex{}) |
|
|
|
lock.(*sync.Mutex).Lock() |
|
|
|
} |
|
|
|
|
|
|
|
func (s *Server) Unlock(token, filename string) error { |
|
|
|
func (s *Server) Unlock(token, filename string) { |
|
|
|
key := path.Join(token, filename) |
|
|
|
s.locks[key].Unlock() |
|
|
|
|
|
|
|
return nil |
|
|
|
lock, _ := s.locks.LoadOrStore(key, &sync.Mutex{}) |
|
|
|
lock.(*sync.Mutex).Unlock() |
|
|
|
} |
|
|
|
|
|
|
|
func (s *Server) CheckMetadata(token, filename string, increaseDownload bool) (Metadata, error) { |
|
|
|