Logout

=Introduction=

This is the logout process as initiated by a user quitting the viewer.

= Logout =

Communication
Communication occurs between:


 * Viewer and region (V <-> R)
 * Region and grid user service (R -> GU)
 * Region and presence service (R -> P)
 * Region and neighbours (R -> RCh)
 * Neighbours and viewer (RCh -> V)
 * Region and other regions containing user's online friends (R -> RFr)

Steps
The steps involving listeners are not exhausive. Only the most significant operations are listed.


 * V->R, on user quit, viewer sends a LogoutRequest UDP packet to the region.
 * R->V, simulator immediate replies with a LogoutReply UDP packet.
 * R, begins to tear down structures specific to the LL connection
 * R, triggers IClientAPI.OnConnectionClosed event internally, causing listeners to
 * R->GU, tell the grid user service that the user has logged out.
 * R->P, tell the presence service that the user has logged out.
 * R, Tell the scene to start cleaning up its data structures (this is the bulk of the cleanup work).
 * R->RCh, tell any neighbours to close their child agents for this viewer.
 * RCh-V, these neighbours will in turn tell the viewer that the regions are closing (not actually necessary).
 * R, triggers EventManager.OnClientClosed event internally, causing listeners to
 * R->P, asks the presence service for which of the user's friends are online.
 * R->RFr, tell regions containing online friends that the user has gone offline.
 * R, triggers EventManager.OnRemovePresence event internally (this duplicates OnClientClosed and may be removed in the future).
 * R, derezzes the avatar's attachments, hence shutting down and saving any attachment script state.
 * R, tells other avatars still in the scene that the user has gone via the KillObject UDP packet.
 * R, removes the scene presence and client structures and removes the avatar's physics object.