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