public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] debuginfod: Use MHD_USE_EPOLL for libmicrohttpd version 0.9.51 or higher
Date: Fri,  6 May 2022 00:38:40 +0200	[thread overview]
Message-ID: <20220505223840.565602-1-mark@klomp.org> (raw)

Also disable MHD_USE_THREAD_PER_CONNECTION when using MHD_USE_EPOLL.

https://sourceware.org/bugzilla/show_bug.cgi?id=29123

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 debuginfod/ChangeLog      |  6 ++++++
 debuginfod/debuginfod.cxx | 15 ++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index e108f847..ce93a9f0 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,9 @@
+2022-05-05  Mark Wielaard  <mark@klomp.org>
+
+	* debuginfod.cxx (main): Define use_epoll. Set to MHD_USE_EPOLL
+	based on MHD_VERSION. Don't use MHD_USE_THREAD_PER_CONNECTION
+	when use_poll is set.
+
 2022-05-05  Mark Wielaard  <mark@klomp.org>
 
 	* debuginfod.cxx (main): Define mhd_flags. Use mhd_flags for
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index c02540f1..d4f47bf7 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1,6 +1,6 @@
 /* Debuginfo-over-http server.
    Copyright (C) 2019-2021 Red Hat, Inc.
-   Copyright (C) 2021 Mark J. Wielaard <mark@klomp.org>
+   Copyright (C) 2021, 2022 Mark J. Wielaard <mark@klomp.org>
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -3899,7 +3899,14 @@ main (int argc, char *argv[])
         }
     }
 
-  unsigned int mhd_flags = ((connection_pool
+  /* Note that MHD_USE_EPOLL and MHD_USE_THREAD_PER_CONNECTION don't
+     work together.  */
+  unsigned int use_epoll = 0;
+#if MHD_VERSION >= 0x00095100
+  use_epoll = MHD_USE_EPOLL;
+#endif
+
+  unsigned int mhd_flags = ((connection_pool || use_epoll
 			     ? 0 : MHD_USE_THREAD_PER_CONNECTION)
 #if MHD_VERSION >= 0x00095300
 			    | MHD_USE_INTERNAL_POLLING_THREAD
@@ -3907,9 +3914,7 @@ main (int argc, char *argv[])
 			    | MHD_USE_SELECT_INTERNALLY
 #endif
 			    | MHD_USE_DUAL_STACK
-#ifdef MHD_USE_EPOLL
-			    | MHD_USE_EPOLL
-#endif
+			    | use_epoll
 #if MHD_VERSION >= 0x00095200
 			    | MHD_USE_ITC
 #endif
-- 
2.30.2


             reply	other threads:[~2022-05-05 22:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 22:38 Mark Wielaard [this message]
2022-05-11 23:00 ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220505223840.565602-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).