present: fix race condition
If one hits "Run" several times, then an old process removes the current process from c.proc.
As a result the new process can't be killed, and we end up with 2 processes running at the same time.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6700043
diff --git a/present/socket.go b/present/socket.go
index 410fb54..858774f 100644
--- a/present/socket.go
+++ b/present/socket.go
@@ -157,7 +157,9 @@
m.Body = err.Error()
}
c.Lock()
- delete(c.proc, id)
+ if c.proc[id] == p {
+ delete(c.proc, id)
+ }
c.Unlock()
c.out <- m
}