Commit c36b0647 authored by Jan Včelák's avatar Jan Včelák 🚀

thread-safe crypto: hook initialization into server code

ref #157
parent 82d5badd
......@@ -54,6 +54,13 @@ char *zone = NULL;
// Cleanup handler
static int do_cleanup(server_t *server, char *configf, char *pidf);
// atexit() handler for server code
static void deinit(void)
{
knot_crypto_cleanup();
knot_crypto_cleanup_threads();
}
// SIGINT signal handler
void interrupt_handle(int s)
{
......@@ -100,7 +107,7 @@ void help(void)
int main(int argc, char **argv)
{
atexit(knot_crypto_cleanup);
atexit(deinit);
// Parse command line arguments
int c = 0, li = 0;
......@@ -167,6 +174,10 @@ int main(int argc, char **argv)
return 1;
}
// Initialize cryptographic backend
knot_crypto_init();
knot_crypto_init_threads();
// Now check if we want to daemonize
if (daemonize) {
if (daemon(1, 0) != 0) {
......
......@@ -352,8 +352,6 @@ server_t *server_create()
return NULL;
}
knot_ns_set_data(server->nameserver, server);
dbg_server("server: initializing crypto backend\n");
knot_crypto_init();
// Create XFR handler
server->xfr = xfr_create(XFR_THREADS_COUNT, server->nameserver);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment