Netflix/RxJava — pull request #312 by petermd (2013-07-27 01:31:14+00:00)
Title: Fix for OperatorOnErrorResumeNextViaObservable and async Resume

This patch is to ensure that OnErrorResumeNextViaObservable handles source Observables that emit invalid sequences of onNext/onError/onCompleted.

Please see #306 for a more detailed description of how this can occur (and what other fixes might be needed)

To re-create the issue the provided resume Observable itself must be async. Because it does not complete immediately there is a window where the source Observable can produce additional events which are then propogated into the output.

The fix ensures the operator only propogates onNext/onCompleted as long as the original subscription is valid. It also prevents the resume subscription happening more than once even if multiple onError events being received.