mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
lib/protocol, rc, utils: Add mutex Unlock before panic (#6556)
This commit is contained in:
parent
0e5ba3ca05
commit
c63ca4f563
@ -289,6 +289,7 @@ func (c *rawConnection) Request(ctx context.Context, folder string, name string,
|
|||||||
|
|
||||||
c.awaitingMut.Lock()
|
c.awaitingMut.Lock()
|
||||||
if _, ok := c.awaiting[id]; ok {
|
if _, ok := c.awaiting[id]; ok {
|
||||||
|
c.awaitingMut.Unlock()
|
||||||
panic("id taken")
|
panic("id taken")
|
||||||
}
|
}
|
||||||
rc := make(chan asyncResult, 1)
|
rc := make(chan asyncResult, 1)
|
||||||
|
@ -547,6 +547,7 @@ func (p *Process) eventLoop() {
|
|||||||
}
|
}
|
||||||
device := p.id.String()
|
device := p.id.String()
|
||||||
if device == "" {
|
if device == "" {
|
||||||
|
p.eventMut.Unlock()
|
||||||
panic("race, or startup not complete")
|
panic("race, or startup not complete")
|
||||||
}
|
}
|
||||||
m[device] = version
|
m[device] = version
|
||||||
|
@ -251,6 +251,7 @@ func (s *service) Stop() {
|
|||||||
s.mut.Lock()
|
s.mut.Lock()
|
||||||
select {
|
select {
|
||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
|
s.mut.Unlock()
|
||||||
panic(fmt.Sprintf("Stop called more than once on %v", s))
|
panic(fmt.Sprintf("Stop called more than once on %v", s))
|
||||||
default:
|
default:
|
||||||
s.cancel()
|
s.cancel()
|
||||||
|
Loading…
Reference in New Issue
Block a user