pellucidanalytics/aws-wrap — pull request #13 by dwhjames (2014-02-20 19:20:41+00:00)
Title: fix the race condition in FutureTransfer.listenFor

As the progress listener is attached to the transfer after the transfer has already started. It is possible that the listener will miss the ‘done’ progress events: ‘completed’, ‘failed’, ‘canceled’. Therefore, after the progress listener is attached, the transfer is also polled to check it it has already completed.

It is theoretically possible for `tryComplete` to be invoked twice, hence `tryComplete`. I’m 99% confident that this code guarantees that `tryComplete` will be invoked at least once!