14 static int joedb_server(
int argc,
char **argv)
17 const bool local =
true;
19 const bool with_database =
false;
21 Client_Parser client_parser(local, default_open_mode, with_database);
25 std::cerr <<
"usage: " << argv[0];
26 std::cerr <<
" [--port p] [--timeout t] [--share]";
27 client_parser.print_help(std::cerr);
29The timeout is the time (in seconds) during which a client lock is kept.
300 (the default) means there is no timeout, and the lock is kept until the
31client unlocks or is disconnected. A client that timed out is not disconnected,
32and can still push data: the push will succeed only if there is no conflict.
40 if (index + 1 < argc && std::strcmp(argv[index],
"--port") == 0)
42 port = uint16_t(std::atoi(argv[index + 1]));
47 if (index + 1 < argc && std::strcmp(argv[index],
"--timeout") == 0)
49 timeout = uint32_t(std::atoi(argv[index + 1]));
54 if (index < argc && std::strcmp(argv[index],
"--share") == 0)
60 Client &client = client_parser.parse(argc - index, argv + index);
62 IO_Context_Wrapper io_context_wrapper;
64 std::cout <<
"Creating server (port = " << port;
65 std::cout <<
"; timeout = " << timeout;
66 std::cout <<
"; share = " << share <<
")\n";
72 io_context_wrapper.io_context,
74 std::chrono::seconds(timeout),
78 io_context_wrapper.run();
85int 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_exception_catcher(int(*main)(int, char **), int argc, char **argv)
Catch exception from main.