T2 amendment: a call after the stop began is answered nothing, never refused
A refusal would end the caller's kept call; left unanswered, the kept call paces and meets the new runner. The ask made once the drain began ends Unanswered, so the bus sends its caller nothing. Builds: design 47 H2 §813 (12), H-A-369
This commit is contained in:
@@ -30,8 +30,16 @@ var asks = struct {
|
||||
ended chan struct{}
|
||||
}{of: map[uint64]*inFlight{}}
|
||||
|
||||
// errStopping is an ask made after the stop: refused, the call made after the stop is not taken (§813 (12)).
|
||||
var errStopping = &Refused{Method: "", Message: "the tool runner is stopping: it takes no new call (design 47 H2 §813 (12))"}
|
||||
// afterStop is an ask made after the stop began: it is not taken and its caller is answered nothing, never refused, so the
|
||||
// caller's kept call paces and meets the new runner (design 47 H2 §813 (12) as H-A-369 amends it).
|
||||
type afterStop struct{ module, verb string }
|
||||
|
||||
func (e *afterStop) Error() string {
|
||||
return fmt.Sprintf("%s's %s was not taken: the tool runner is stopping, and a call after its stop is answered nothing", e.module, e.verb)
|
||||
}
|
||||
|
||||
// Unanswered says the call is left without an answer, so its kept call asks again and meets the new runner.
|
||||
func (e *afterStop) Unanswered() bool { return true }
|
||||
|
||||
// cutCall is a call the drain cut at its bound. Its caller is answered nothing, so it sees a transport fault (§813 (12)): the
|
||||
// bus reads Unanswered and sends no reply.
|
||||
@@ -44,12 +52,12 @@ func (e *cutCall) Error() string {
|
||||
// Unanswered says the call is left without an answer, so its caller sees a transport fault.
|
||||
func (e *cutCall) Unanswered() bool { return true }
|
||||
|
||||
// begin records an ask about to be made, or refuses it once the runner drains.
|
||||
// begin records an ask about to be made; once the runner drains it takes none, and its caller is answered nothing.
|
||||
func begin(module, verb string) (uint64, *inFlight, error) {
|
||||
asks.mu.Lock()
|
||||
defer asks.mu.Unlock()
|
||||
if asks.draining {
|
||||
return 0, nil, errStopping
|
||||
return 0, nil, &afterStop{module: module, verb: verb}
|
||||
}
|
||||
asks.next++
|
||||
f := &inFlight{module: module, verb: verb, at: time.Now(), cut: make(chan struct{})}
|
||||
|
||||
Reference in New Issue
Block a user