//! Utility functions.
use Duration;
use Scheme;
use TcpStream;
use crateProxyTarget;
/// Repeatedly tries to connect to the given proxy via TCP, returning once a
/// connection was established.
///
/// After each attempt, this function waits for `poll_period` before trying
/// again. If the proxy target is never reachable, this function's future never
/// resolves. To stop this function after some timeout, use some external
/// functions, e.g. `tokio::time::timeout`.
///
/// This function can be used just before calling
/// [`Controller::reload`][super::Controller::reload] to make sure the proxy
/// server is ready. This avoids the user seeing "Cannot reach proxy target".
pub async