When is OnDone called on the server?
All reactions must finish running (including OnCancel when relevant) and server must have called Finish.
What is “within-reactor flow” vs. “outside-reactor flow” and why does it matter?
Within-reactor flow is when operations are started from inside reactions (or the reactor constructor) such as OnWriteDone starting another write. These make sense since there can only be one read and one write in flight and starting them from the reaction can help maintain that.
Outside-reactor flow is when operations on the stream are started from outside reactions. This makes sense since reactions aren’t supposed to block and the application may not be ready to perform its next read or write. Note that outside-reactor flows require the use of holds to synchronize on the client side. Server side uses Finish to synchronize outside-reactor calls; the application should not start more operations after calling Finish.