13 static int keepalive_test(Arguments &arguments)
15 Parsed_Logger logger(arguments);
17 const std::string_view user = arguments.get_next(
"user");
18 const std::string_view host = arguments.get_next(
"host");
19 const std::string_view endpoint_path = arguments.get_next(
"endpoint_path");
21 if (arguments.missing())
23 arguments.print_help(std::cerr);
27 std::chrono::seconds wait(1);
28 std::chrono::seconds increment(1);
31 Writable_Journal journal(file);
35 ssh::Session session(user.data(), host.data(), 22, 0);
36 ssh::Forward_Channel channel(session, endpoint_path.data());
37 Server_Connection connection(channel, logger.get());
42 channel.set_timeout(wait + increment + std::chrono::seconds(30));
43 client.pull(wait + increment);
44 wait = wait + increment;
47 catch (
const std::exception &e)
49 std::cerr <<
"Caught exception: " << e.what() <<
'\n';
50 increment = (std::chrono::seconds(3) + increment) / 4;
58int main(
int argc,
char **argv)
int main_wrapper(int(*main)(Arguments &), int argc, char **argv)
Process command-line arguments and catch exceptions from main.