tDo curl setup after server fork - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 0bec2afaac878b1443ae6df0606a7d58d2aa8619
(DIR) parent b3c69991013fc3e7b670203d26508e71362d5a23
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Thu, 3 Dec 2020 22:37:28 -0800
Do curl setup after server fork
If the server is run as a daemon, init
curl and register with the metaserver
*after* the fork - otherwise the registration
may fail as the process starting the registration
is not the one receiving the https reply.
Diffstat:
M src/serverside.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/src/serverside.c b/src/serverside.c
t@@ -766,11 +766,6 @@ static gboolean StartServer(void)
Scanner->msg_handler = ScannerErrorHandler;
Scanner->input_name = "(stdin)";
- CurlInit(&MetaConn);
-#ifdef GUI_SERVER
- SetCurlCallback(&MetaConn, glib_timeout, glib_socket);
-#endif
-
/* Make the output line-buffered, so that the log file (if used) is
* updated regularly */
fflush(stdout);
t@@ -858,9 +853,16 @@ static gboolean StartServer(void)
g_warning(_("Cannot install pipe handler!"));
}
#endif
+ return TRUE;
+}
+static void InitMetaServer()
+{
+ CurlInit(&MetaConn);
+#ifdef GUI_SERVER
+ SetCurlCallback(&MetaConn, glib_timeout, glib_socket);
+#endif
RegisterWithMetaServer(TRUE, TRUE, FALSE);
- return TRUE;
}
/*
t@@ -1193,6 +1195,7 @@ void ServerLoop(struct CMDLINE *cmdline)
return;
#endif
CreatePidFile();
+ InitMetaServer();
#ifndef CYGWIN
localsock = SetupLocalSocket();