mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
lib/util: Fix potential data race (#6477)
Co-authored-by: greatroar <@>
This commit is contained in:
parent
7709ac33a7
commit
d7a257b391
@ -255,8 +255,12 @@ func (s *service) Stop() {
|
||||
default:
|
||||
s.cancel()
|
||||
}
|
||||
|
||||
// Cache s.stopped in a variable while we hold the mutex
|
||||
// to prevent a data race with Serve's resetting it.
|
||||
stopped := s.stopped
|
||||
s.mut.Unlock()
|
||||
<-s.stopped
|
||||
<-stopped
|
||||
}
|
||||
|
||||
func (s *service) Error() error {
|
||||
|
Loading…
Reference in New Issue
Block a user