TheTorProject/ooni-probe — pull request #275 by hellais (2014-02-03 15:41:02+00:00)
Title: Write test that reproduces HTTP test stalling condition.

The condition would happen when a HTTP server would keep the connection open
without sending any data. The problem lied in the fact that we were not
properly cancelling tests that should have been cancelled.

This was happening because of 2 reasons:
1) We should not be checking to see if self._running.called is True since it is
possible that such deferred has been called, but the it has not yet made it's
way down the callback chain to the ooni registered callbacks.
2) We must call the cancel() method after we have called the failed() method.
Failing to do so will lead to the newly scheduled timer to be cancelled instead
of the previous one.