Commit Diff


commit - 47b0ff105a152b5f44bddaacc41318872370a222
commit + 3886afceec08126fede93edee884cbd13078cbec
blob - c7b1c4e761c949eb2f44002fdde6272f07a73b26
blob + 2078a2c213e9096a0da012e722aff9f29f4a2d16
--- gmid.h
+++ gmid.h
@@ -370,6 +370,8 @@ void		 start_reply(struct client*, int, const char*);
 void		 client_close(struct client *);
 struct client	*client_by_id(int);
 void		 do_accept(int, short, void *);
+void		 server_init(struct privsep *, struct privsep_proc *, void *);
+int		 server_configure_done(struct conf *);
 void		 server(struct privsep *ps, struct privsep_proc *);
 
 int		 client_tree_cmp(struct client *, struct client *);
blob - ae46559b154cf61ffaaed91c2c9e57b67718f630
blob + eba98da834d4dae16caa71664ae850a29cbca498
--- server.c
+++ server.c
@@ -73,7 +73,6 @@ static void	 client_close_ev(int, short, void *);
 
 static void	 handle_siginfo(int, short, void*);
 
-static void	 server_init(struct privsep *, struct privsep_proc *, void *);
 static int	 server_dispatch_parent(int, struct privsep_proc *, struct imsg *);
 static int	 server_dispatch_logger(int, struct privsep_proc *, struct imsg *);
 
@@ -1432,7 +1431,7 @@ server(struct privsep *ps, struct privsep_proc *p)
 	proc_run(ps, p, procs, nitems(procs), server_init, NULL);
 }
 
-static void
+void
 server_init(struct privsep *ps, struct privsep_proc *p, void *arg)
 {
 	SPLAY_INIT(&clients);
@@ -1446,6 +1445,22 @@ server_init(struct privsep *ps, struct privsep_proc *p
 	signal_add(&sigusr2, NULL);
 
 	sandbox_server_process();
+}
+
+int
+server_configure_done(struct conf *conf)
+{
+	if (load_default_mime(&conf->mime) == -1)
+		fatal("can't load default mime");
+	sort_mime(&conf->mime);
+	setup_tls();
+	load_vhosts();
+	if (conf->sock4 != -1)
+		event_add(&conf->evsock4, NULL);
+	if (conf->sock6 != -1)
+		event_add(&conf->evsock6, NULL);
+
+	return 0;
 }
 
 static int
@@ -1474,15 +1489,8 @@ server_dispatch_parent(int fd, struct privsep_proc *p,
 	case IMSG_RECONF_END:
 		if (config_recv(conf, imsg) == -1)
 			return -1;
-		if (load_default_mime(&conf->mime) == -1)
-			fatal("can't load default mime");
-		sort_mime(&conf->mime);
-		setup_tls();
-		load_vhosts();
-		if (conf->sock4 != -1)
-			event_add(&conf->evsock4, NULL);
-		if (conf->sock6 != -1)
-			event_add(&conf->evsock6, NULL);
+		if (server_configure_done(conf) == -1)
+			return -1;
 		break;
 	default:
 		return -1;