Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We should use the stream's and server's contexts directly. The subcontexts made the code obscure. This aims to make clearer that forceful stop cancels the streams contexts while the graceful stop allows the RPCs to finish their current activities on their own before stopping the loops. This method derived two context ojects mirroring the structure found in the Server type: `gCtx` for graceful stop and `ctx` for "brute forcing". They were arrenged in such a way that the local `gCtx` is child of `ctx`. If the server own `ctx` is cancelled to force a stop, depending on the moment that happens it could be interpreted by this method as a graceful stop (because it only checks `gCtx` and that can be cancelled due its parent being cancelled). The whole point here is that `server.Stop()` is assumed in tests to cause `server.Serve()` to return a non-nil error. But that can only happen if the handling loop objects fail or perceive a brute-force cancellation. If `handlingLooop[Command].run()` perceives `server.Stop()` as a graceful cancellation, then they won't return errors. Co-authored-by: Didier Roche-Tolomelli <[email protected]>
- Loading branch information