summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBoqin Qin <bobbqqin@bupt.edu.cn>2020-04-20 20:52:16 +0800
committerGitHub <noreply@github.com>2020-04-20 14:52:16 +0200
commitc63ca4f5630352e75fbabc56ca4ea6582d3afb13 (patch)
tree604aceb2e7b3a2c3565cef307a962a0314073274 /lib
parent0e5ba3ca054a9f28e93af951489ef8135fe328b3 (diff)
lib/protocol, rc, utils: Add mutex Unlock before panic (#6556)
Diffstat (limited to 'lib')
-rw-r--r--lib/protocol/protocol.go1
-rw-r--r--lib/rc/rc.go1
-rw-r--r--lib/util/utils.go1
3 files changed, 3 insertions, 0 deletions
diff --git a/lib/protocol/protocol.go b/lib/protocol/protocol.go
index f59695a25..4811f315e 100644
--- a/lib/protocol/protocol.go
+++ b/lib/protocol/protocol.go
@@ -289,6 +289,7 @@ func (c *rawConnection) Request(ctx context.Context, folder string, name string,
c.awaitingMut.Lock()
if _, ok := c.awaiting[id]; ok {
+ c.awaitingMut.Unlock()
panic("id taken")
}
rc := make(chan asyncResult, 1)
diff --git a/lib/rc/rc.go b/lib/rc/rc.go
index 4ba43f52e..a6d658a15 100644
--- a/lib/rc/rc.go
+++ b/lib/rc/rc.go
@@ -547,6 +547,7 @@ func (p *Process) eventLoop() {
}
device := p.id.String()
if device == "" {
+ p.eventMut.Unlock()
panic("race, or startup not complete")
}
m[device] = version
diff --git a/lib/util/utils.go b/lib/util/utils.go
index 1851aa035..c8ff701c6 100644
--- a/lib/util/utils.go
+++ b/lib/util/utils.go
@@ -251,6 +251,7 @@ func (s *service) Stop() {
s.mut.Lock()
select {
case <-s.ctx.Done():
+ s.mut.Unlock()
panic(fmt.Sprintf("Stop called more than once on %v", s))
default:
s.cancel()