15 static int server(Arguments &arguments)
18 std::string default_endpoint_path =
"joedb.sock";
19 for (
size_t i = 1; i < arguments.size(); i++)
21 const std::string_view v = arguments[i];
22 if (v.size() > 6 && v.compare(v.size() - 6, 6,
".joedb") == 0)
24 default_endpoint_path = std::string(v) +
".sock";
29 const int log_level = arguments.get_option<
int>(
"log_level",
"level", 100);
31 const std::string_view endpoint_path = arguments.get_string_option
35 default_endpoint_path.c_str()
38 const float timeout_seconds = arguments.get_option<
float>
47 Client_Parser client_parser
54 if (!client_parser.get())
56 arguments.print_help(std::cerr) <<
'\n';
57 client_parser.print_help(std::cerr);
61 Client &client = *client_parser.get();
63 std::cout <<
"Creating server (endpoint_path = " << endpoint_path;
64 std::cout <<
"; timeout = " << timeout_seconds <<
")\n";
66 Stream_Logger logger(std::cerr);
68 const int thread_count = 1;
75 std::string(endpoint_path),
77 std::chrono::milliseconds(std::lround(timeout_seconds * 1000))
87int main(
int argc,
char **argv)
@ write_existing_or_create_new
either write_existing or create_new depending on whether the file exists. Racy in Posix,...
int main_wrapper(int(*main)(Arguments &), int argc, char **argv)
Process command-line arguments and catch exceptions from main.