good morning!!!!

Skip to content
Snippets Groups Projects
Commit 8f4c4fea authored by Janoš Guljaš's avatar Janoš Guljaš Committed by Péter Szilágyi
Browse files

p2p: fix rare deadlock in Stop (#17260)

parent d42ce0f2
No related branches found
No related tags found
No related merge requests found
......@@ -340,8 +340,8 @@ func (srv *Server) makeSelf(listener net.Listener, ntab discoverTable) *discover
// It blocks until all active connections have been closed.
func (srv *Server) Stop() {
srv.lock.Lock()
defer srv.lock.Unlock()
if !srv.running {
srv.lock.Unlock()
return
}
srv.running = false
......@@ -350,6 +350,7 @@ func (srv *Server) Stop() {
srv.listener.Close()
}
close(srv.quit)
srv.lock.Unlock()
srv.loopWG.Wait()
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment