|
|
893516 |
commit ba675ed25a26fd425ffd19b02cf18babf4291b4f
|
|
|
893516 |
Author: Mark Wielaard <mark@klomp.org>
|
|
|
893516 |
Date: Thu May 5 23:59:57 2022 +0200
|
|
|
893516 |
|
|
|
893516 |
debuginfod: Try without MHD_USE_DUAL_STACK if MHD_start_daemon fails
|
|
|
893516 |
|
|
|
893516 |
On a systems that have ipv6 disabled debuginfod doesn't start up
|
|
|
893516 |
anymore because libhttpd MHD_USE_DUAL_STACK only works if it can
|
|
|
893516 |
open an ipv6 socket. If MHD_start_daemon with MHD_USE_DUAL_STACK
|
|
|
893516 |
fails try again without that flag set.
|
|
|
893516 |
|
|
|
893516 |
https://sourceware.org/bugzilla/show_bug.cgi?id=29122
|
|
|
893516 |
|
|
|
893516 |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
893516 |
|
|
|
893516 |
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
|
|
|
893516 |
index 4aaf41c0..c02540f1 100644
|
|
|
893516 |
--- a/debuginfod/debuginfod.cxx
|
|
|
893516 |
+++ b/debuginfod/debuginfod.cxx
|
|
|
893516 |
@@ -3899,40 +3899,67 @@ main (int argc, char *argv[])
|
|
|
893516 |
}
|
|
|
893516 |
}
|
|
|
893516 |
|
|
|
893516 |
- // Start httpd server threads. Use a single dual-homed pool.
|
|
|
893516 |
- MHD_Daemon *d46 = MHD_start_daemon ((connection_pool ? 0 : MHD_USE_THREAD_PER_CONNECTION)
|
|
|
893516 |
+ unsigned int mhd_flags = ((connection_pool
|
|
|
893516 |
+ ? 0 : MHD_USE_THREAD_PER_CONNECTION)
|
|
|
893516 |
#if MHD_VERSION >= 0x00095300
|
|
|
893516 |
- | MHD_USE_INTERNAL_POLLING_THREAD
|
|
|
893516 |
+ | MHD_USE_INTERNAL_POLLING_THREAD
|
|
|
893516 |
#else
|
|
|
893516 |
- | MHD_USE_SELECT_INTERNALLY
|
|
|
893516 |
+ | MHD_USE_SELECT_INTERNALLY
|
|
|
893516 |
#endif
|
|
|
893516 |
+ | MHD_USE_DUAL_STACK
|
|
|
893516 |
#ifdef MHD_USE_EPOLL
|
|
|
893516 |
- | MHD_USE_EPOLL
|
|
|
893516 |
+ | MHD_USE_EPOLL
|
|
|
893516 |
#endif
|
|
|
893516 |
- | MHD_USE_DUAL_STACK
|
|
|
893516 |
#if MHD_VERSION >= 0x00095200
|
|
|
893516 |
- | MHD_USE_ITC
|
|
|
893516 |
+ | MHD_USE_ITC
|
|
|
893516 |
#endif
|
|
|
893516 |
- | MHD_USE_DEBUG, /* report errors to stderr */
|
|
|
893516 |
- http_port,
|
|
|
893516 |
- NULL, NULL, /* default accept policy */
|
|
|
893516 |
- handler_cb, NULL, /* handler callback */
|
|
|
893516 |
- MHD_OPTION_EXTERNAL_LOGGER, error_cb, NULL,
|
|
|
893516 |
- (connection_pool ? MHD_OPTION_THREAD_POOL_SIZE : MHD_OPTION_END),
|
|
|
893516 |
- (connection_pool ? (int)connection_pool : MHD_OPTION_END),
|
|
|
893516 |
- MHD_OPTION_END);
|
|
|
893516 |
+ | MHD_USE_DEBUG); /* report errors to stderr */
|
|
|
893516 |
|
|
|
893516 |
+ // Start httpd server threads. Use a single dual-homed pool.
|
|
|
893516 |
+ MHD_Daemon *d46 = MHD_start_daemon (mhd_flags, http_port,
|
|
|
893516 |
+ NULL, NULL, /* default accept policy */
|
|
|
893516 |
+ handler_cb, NULL, /* handler callback */
|
|
|
893516 |
+ MHD_OPTION_EXTERNAL_LOGGER,
|
|
|
893516 |
+ error_cb, NULL,
|
|
|
893516 |
+ (connection_pool
|
|
|
893516 |
+ ? MHD_OPTION_THREAD_POOL_SIZE
|
|
|
893516 |
+ : MHD_OPTION_END),
|
|
|
893516 |
+ (connection_pool
|
|
|
893516 |
+ ? (int)connection_pool
|
|
|
893516 |
+ : MHD_OPTION_END),
|
|
|
893516 |
+ MHD_OPTION_END);
|
|
|
893516 |
+
|
|
|
893516 |
+ MHD_Daemon *d4 = NULL;
|
|
|
893516 |
if (d46 == NULL)
|
|
|
893516 |
{
|
|
|
893516 |
- sqlite3 *database = db;
|
|
|
893516 |
- sqlite3 *databaseq = dbq;
|
|
|
893516 |
- db = dbq = 0; // for signal_handler not to freak
|
|
|
893516 |
- sqlite3_close (databaseq);
|
|
|
893516 |
- sqlite3_close (database);
|
|
|
893516 |
- error (EXIT_FAILURE, 0, "cannot start http server at port %d", http_port);
|
|
|
893516 |
- }
|
|
|
893516 |
+ // Cannot use dual_stack, use ipv4 only
|
|
|
893516 |
+ mhd_flags &= ~(MHD_USE_DUAL_STACK);
|
|
|
893516 |
+ d4 = MHD_start_daemon (mhd_flags, http_port,
|
|
|
893516 |
+ NULL, NULL, /* default accept policy */
|
|
|
893516 |
+ handler_cb, NULL, /* handler callback */
|
|
|
893516 |
+ MHD_OPTION_EXTERNAL_LOGGER,
|
|
|
893516 |
+ error_cb, NULL,
|
|
|
893516 |
+ (connection_pool
|
|
|
893516 |
+ ? MHD_OPTION_THREAD_POOL_SIZE
|
|
|
893516 |
+ : MHD_OPTION_END),
|
|
|
893516 |
+ (connection_pool
|
|
|
893516 |
+ ? (int)connection_pool
|
|
|
893516 |
+ : MHD_OPTION_END),
|
|
|
893516 |
+ MHD_OPTION_END);
|
|
|
893516 |
+ if (d4 == NULL)
|
|
|
893516 |
+ {
|
|
|
893516 |
+ sqlite3 *database = db;
|
|
|
893516 |
+ sqlite3 *databaseq = dbq;
|
|
|
893516 |
+ db = dbq = 0; // for signal_handler not to freak
|
|
|
893516 |
+ sqlite3_close (databaseq);
|
|
|
893516 |
+ sqlite3_close (database);
|
|
|
893516 |
+ error (EXIT_FAILURE, 0, "cannot start http server at port %d",
|
|
|
893516 |
+ http_port);
|
|
|
893516 |
+ }
|
|
|
893516 |
|
|
|
893516 |
- obatched(clog) << "started http server on IPv4 IPv6 "
|
|
|
893516 |
+ }
|
|
|
893516 |
+ obatched(clog) << "started http server on"
|
|
|
893516 |
+ << (d4 != NULL ? " IPv4 " : " IPv4 IPv6 ")
|
|
|
893516 |
<< "port=" << http_port << endl;
|
|
|
893516 |
|
|
|
893516 |
// add maxigroom sql if -G given
|
|
|
893516 |
@@ -4053,6 +4080,7 @@ main (int argc, char *argv[])
|
|
|
893516 |
|
|
|
893516 |
/* Stop all the web service threads. */
|
|
|
893516 |
if (d46) MHD_stop_daemon (d46);
|
|
|
893516 |
+ if (d4) MHD_stop_daemon (d4);
|
|
|
893516 |
|
|
|
893516 |
if (! passive_p)
|
|
|
893516 |
{
|