diff --git a/repertory/repertory/include/cli/mount.hpp b/repertory/repertory/include/cli/mount.hpp index 6631e946..ca03a4ea 100644 --- a/repertory/repertory/include/cli/mount.hpp +++ b/repertory/repertory/include/cli/mount.hpp @@ -121,11 +121,32 @@ mount(std::vector args, std::string data_directory, << " Drive" << std::endl; if (prov == provider_type::remote) { try { + constexpr const std::uint8_t retry_count{30U}; + auto remote_cfg = config.get_remote_config(); remote_cfg.host_name_or_ip = remote_host; remote_cfg.api_port = remote_port; config.set_remote_config(remote_cfg); + std::cout << "Connecting to remote [" << remote_host << ':' << remote_port + << "] ..." << std::flush; + auto online{false}; + for (std::uint8_t retry{0U}; not online && retry < retry_count; ++retry) { + online = remote_client(config).check() == 0; + if (online) { + continue; + } + std::cout << "." << std::flush; + std::this_thread::sleep_for(1s); + } + + if (not online) { + std::cerr << " failed! remote host is offline." << std::endl; + return exit_code::communication_error; + } + + std::cout << " done!" << std::endl; + remote_drive drive( config, [&config]() -> std::unique_ptr {