summaryrefslogtreecommitdiffstats
path: root/src/server/server.c
diff options
context:
space:
mode:
authorsr2012-08-27 21:02:49 +0200
committersr2012-08-27 21:02:49 +0200
commitde01183aa40dbbd274e18f681d8a255a886f493e (patch)
treef614e764704aec26df15df68c633178064c60a41 /src/server/server.c
parent[KERNEL] Make rtt threshold relative (diff)
downloaddnbd3-de01183aa40dbbd274e18f681d8a255a886f493e.tar.gz
dnbd3-de01183aa40dbbd274e18f681d8a255a886f493e.tar.xz
dnbd3-de01183aa40dbbd274e18f681d8a255a886f493e.zip
[KERNEL] Refactor and extend sysfs (add data the server will need in proxy mode)
[SERVER] Use MSG_MORE instead of cork/uncork to save two syscalls [KERNEL] Fail-Counter for alt servers, ignore servers that fail too often [KERNEL] Add new alt servers to list, instead of replacing the old list [*] Add CMD_LATEST_RID to tell client about new revisions
Diffstat (limited to 'src/server/server.c')
-rw-r--r--src/server/server.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/server/server.c b/src/server/server.c
index b2a36a5..965c368 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -37,6 +37,9 @@
#include "memlog.h"
int _sock;
+#ifdef _DEBUG
+int _fake_delay = 0;
+#endif
pthread_spinlock_t _spinlock;
GSList *_dnbd3_clients = NULL;
@@ -48,6 +51,9 @@ void dnbd3_print_help(char* argv_0)
printf("Usage: %s [OPTIONS]...\n", argv_0);
printf("Start the DNBD3 server\n");
printf("-f or --file \t\t Configuration file (default /etc/dnbd3-server.conf)\n");
+#ifdef _DEBUG
+ printf("-d or --delay \t\t Add a fake network delay of X µs\n");
+#endif
printf("-n or --nodaemon \t Start server in foreground\n");
printf("-r or --reload \t\t Reload configuration file\n");
printf("-s or --stop \t\t Stop running dnbd3-server\n");
@@ -119,10 +125,11 @@ int main(int argc, char* argv[])
int demonize = 1;
int opt = 0;
int longIndex = 0;
- static const char *optString = "f:nrsiHV?";
+ static const char *optString = "f:d:nrsiHV?";
static const struct option longOpts[] =
{
{ "file", required_argument, NULL, 'f' },
+ { "delay", required_argument, NULL, 'd' },
{ "nodaemon", no_argument, NULL, 'n' },
{ "reload", no_argument, NULL, 'r' },
{ "stop", no_argument, NULL, 's' },
@@ -137,8 +144,16 @@ int main(int argc, char* argv[])
switch (opt)
{
case 'f':
- _config_file_name = optarg;
+ _config_file_name = strdup(optarg);
break;
+ case 'd':
+#ifdef _DEBUG
+ _fake_delay = atoi(optarg);
+ break;
+#else
+ printf("This option is only available in debug builds.\n\n");
+ return EXIT_FAILURE;
+#endif
case 'n':
demonize = 0;
break;