node-tools: a serve racing the runner's stop is taken down too (issue 721, review round 1)
A tool's or a proof's subscription made while the stop took its snapshot was registered after it, so it stayed subscribed until the close and its callers waited out their bound instead of meeting no responders (the review's probe: 4 of 2000 rounds). Now a new answering subscription is kept, and the stop checked again, in one section under the lock the stop takes its subscriptions down under; when the stop began meanwhile, it is drained and the serve refused. Tests: 721/AC4 rows in the bus (a tool's serve and a proof answerer each run the stop between their subscription and its keeping, through a test hook, and are refused; their callers meet no responders), failing without the locked check. Builds: design 47 H2 H-A-570 (1)
This commit is contained in:
@@ -6,3 +6,11 @@ func SetTickHook(f func()) (restore func()) {
|
||||
tickHook = f
|
||||
return func() { tickHook = old }
|
||||
}
|
||||
|
||||
// SetSubscribedHook makes c call f with the subject between making each answering subscription and keeping it, so a test can
|
||||
// run the stop in between (design 47 H2 H-A-570 (1)).
|
||||
func SetSubscribedHook(c *Conn, f func(subject string)) {
|
||||
c.mu.Lock()
|
||||
c.subscribedHook = f
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user