| 565 | |
| 566 | |
| 567 | Future<Nothing> ServiceManagerProcess::waitEndpoint(const string& endpoint) |
| 568 | { |
| 569 | CHECK(strings::startsWith(endpoint, "unix://")); |
| 570 | const string endpointPath = |
| 571 | strings::remove(endpoint, "unix://", strings::PREFIX); |
| 572 | |
| 573 | if (os::exists(endpointPath)) { |
| 574 | return Nothing(); |
| 575 | } |
| 576 | |
| 577 | // Wait for the endpoint socket to appear until the timeout expires. |
| 578 | Timeout timeout = Timeout::in(CSI_ENDPOINT_CREATION_TIMEOUT); |
| 579 | |
| 580 | return process::loop( |
| 581 | [=]() -> Future<Nothing> { |
| 582 | if (timeout.expired()) { |
| 583 | return Failure("Timed out waiting for endpoint '" + endpoint + "'"); |
| 584 | } |
| 585 | |
| 586 | return process::after(Milliseconds(10)); |
| 587 | }, |
| 588 | [=](const Nothing&) -> ControlFlow<Nothing> { |
| 589 | if (os::exists(endpointPath)) { |
| 590 | return Break(); |
| 591 | } |
| 592 | |
| 593 | return Continue(); |
| 594 | }); |
| 595 | } |
| 596 | |
| 597 | |
| 598 | Future<Nothing> ServiceManagerProcess::probeEndpoint(const string& endpoint) |
nothing calls this directly
no test coverage detected