twisted.internet.testing.waitUntilAllDisconnected(reactor, protocols)
function documentationtwisted.internet.testing
View Source
Take a list of disconnecting protocols, callback a Deferred
when they're all done.
This is a hack to make some older tests less flaky, as ITransport.loseConnection
is not atomic on all reactors (for example, the CoreFoundation, which sometimes takes a reactor turn for CFSocket to realise). New tests should either not use real sockets in testing, or take the advice in https://jml.io/pages/how-to-disconnect-in-twisted-really.html to heart.
Parameters | reactor | The reactor to schedule the checks on. (type: IReactorTime ) |
protocols | The protocols to wait for disconnecting. (type: A list of IProtocol s.) |
Function | _check | Undocumented |