Commit Graph

10 Commits

Author SHA1 Message Date
Brian Warner
40e0d6b663 more work, feels better now 2017-04-06 12:21:00 -07:00
Brian Warner
16c477424c more demo work 2017-04-06 12:21:00 -07:00
Brian Warner
7f3e86acca more fussing, split out M_S0 2017-04-06 12:21:00 -07:00
Brian Warner
0b28137948 w3.dot: figure out close() pathways
d=M_close() will always do the verbose clean shutdown thing, and the Deferred
won't fire (e.g. we won't move to state "Ss") until we've deallocated our
server resources (nameplates and mailboxes), and we've finished shutting down
our websocket connection. So integration tests should wait on the Deferred to
make sure everything has stopped moving and the reactor is clean.

CLI applications that are following the success path can use M_close() and
wait on the Deferred before terminating.

CLI applications that wind up on some error path can either use M_close(), or
just SIGINT and leave the server to GC stuff later.

GUI applications can use M_close() but ignore the Deferred, and assume that
the program will keep running long enough to get the deallocation messages
through.

GUI+DB applications can use M_close() and then stop recording state changes,
and if the program remains running long enough, everything will be
deallocated, but if it terminates too soon, the server will have to GC.
2017-04-06 12:21:00 -07:00
Brian Warner
86f246dbdb just might work. close() mapped out.
Starting to draw a distinction between clean-close and abrupt-halt. At least,
if we're in the connected state, wormhole.close() should take its time and
free up server-side resources (nameplate/mailbox) right away, rather than
relying on GC/timeouts to release them.

It might be useful to make separate "clean" wormhole.close() and "abrupt"
wormhole.halt() API calls, except that really when would you ever call halt?
To be realistic, only one of two things will happen:

* connection happens normally, app finishes, calls "clean" close()
* app terminates suddenly, via exception or SIGINT

The problem with defining .close() is that I have to make it work sensibly
from any state, not just the one plausible "connected" state. Providing
.halt() requires defining its behavior from everywhere else.
2017-04-06 12:21:00 -07:00
Brian Warner
2cfc990d5e more 2017-04-06 12:21:00 -07:00
Brian Warner
fa76b57976 w2.dot: add M_ prefix 2017-04-06 12:21:00 -07:00
Brian Warner
e7b2a7bbf9 fixing 118 is the key 2017-04-06 12:21:00 -07:00
Brian Warner
f27e601e41 more 2017-04-06 12:21:00 -07:00
Brian Warner
78fcb6b809 new approach, thinking about connections up front 2017-04-06 12:21:00 -07:00