Function penguin::util::wait_for_proxy
source · pub async fn wait_for_proxy(target: &ProxyTarget, poll_period: Duration)
Expand description
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
to make sure the proxy
server is ready. This avoids the user seeing “Cannot reach proxy target”.