josevalim/xgen — pull request #4 by fishcakez (2014-03-30 23:13:37+00:00)
Title: Fix manager unregisters or exits during GenEvent stream

Some related things stream needs to handle (easier to solve in one go)

Previously if a manager unregistered, the handler would not be removed during cleanup. This could occur due to a netsplit when registered using a distributed register such as :global.

Previously if the manager exited without sending the :gen_event_EXIT message the stream would not stop. This could happen if the GenEvent was on a disconnected node or was killed.

Previously if the manager was shutdown this would cause a stream to stop. However an attempt to remove the handler would fail because the manager was down.

Not handled:
If the manager shutdowns because its parent sends a non-kill exit signal a :gen_event_EXIT is sent AND then an exit signal. Should an attempt be made to flush the exit message?