12 static int keepalive_test(Arguments &arguments)
14 const std::string_view user = arguments.get_next(
"user");
15 const std::string_view host = arguments.get_next(
"host");
16 const std::string_view endpoint_path = arguments.get_next(
"endpoint_path");
18 if (arguments.missing())
20 arguments.print_help(std::cerr);
24 std::chrono::seconds wait(1);
25 std::chrono::seconds increment(1);
28 Writable_Journal journal(file);
32 ssh::Session session(user.data(), host.data(), 22, 0);
33 ssh::Forward_Channel channel(session, endpoint_path.data());
34 Server_Connection connection(channel, &std::cerr);
39 channel.set_timeout(wait + increment + std::chrono::seconds(30));
40 client.pull(wait + increment);
41 wait = wait + increment;
44 catch (
const std::exception &e)
46 std::cerr <<
"Caught exception: " << e.what() <<
'\n';
47 increment = (std::chrono::seconds(3) + increment) / 4;
55int main(
int argc,
char **argv)
int main_wrapper(int(*main)(Arguments &), int argc, char **argv)
Process command-line arguments and catch exceptions from main.