summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-11-25 23:21:22 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-01-18 01:15:54 -0500
commitc54ff8e3586adec9e21c525bf0fa1fa0b73006d6 (patch)
tree4036ab0528b0a413ce0a0c4cca223ed726905572 /src/journal
parenta6c4586586af4656e827014a4df1918103d9d5f2 (diff)
journal-gatewayd: unify two code paths
In preparation for adding more options, split out the option handling code.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-gatewayd.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/journal/journal-gatewayd.c b/src/journal/journal-gatewayd.c
index 63d9744776..9c33218822 100644
--- a/src/journal/journal-gatewayd.c
+++ b/src/journal/journal-gatewayd.c
@@ -879,22 +879,22 @@ int main(int argc, char *argv[]) {
} else if (n > 1) {
log_error("Can't listen on more than one socket.");
goto finish;
- } else if (n > 0) {
- d = MHD_start_daemon(
- MHD_USE_THREAD_PER_CONNECTION|MHD_USE_POLL|MHD_USE_DEBUG,
- 19531,
- NULL, NULL,
- request_handler, NULL,
- MHD_OPTION_LISTEN_SOCKET, SD_LISTEN_FDS_START,
- MHD_OPTION_NOTIFY_COMPLETED, request_meta_free, NULL,
- MHD_OPTION_END);
} else {
+ struct MHD_OptionItem opts[] = {
+ { MHD_OPTION_NOTIFY_COMPLETED,
+ (intptr_t) request_meta_free, NULL },
+ { MHD_OPTION_END, 0, NULL },
+ { MHD_OPTION_END, 0, NULL }};
+ if (n > 0)
+ opts[1] = (struct MHD_OptionItem)
+ {MHD_OPTION_LISTEN_SOCKET, SD_LISTEN_FDS_START, NULL};
+
d = MHD_start_daemon(
- MHD_USE_DEBUG|MHD_USE_THREAD_PER_CONNECTION|MHD_USE_POLL,
+ MHD_USE_THREAD_PER_CONNECTION|MHD_USE_POLL|MHD_USE_DEBUG,
19531,
NULL, NULL,
request_handler, NULL,
- MHD_OPTION_NOTIFY_COMPLETED, request_meta_free, NULL,
+ MHD_OPTION_ARRAY, opts,
MHD_OPTION_END);
}