From 6cae0a18e4fb6fc3469b5bdf75f888f580dbdec0 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Wed, 14 Sep 2011 16:12:29 +0000 Subject: [PATCH] Reinitialize verto after creating worker child Also mark fd events as reinitiable so they survive the fork. From npmccallum@redhat.com. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25175 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kdc/main.c | 2 ++ src/lib/apputils/net-server.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/kdc/main.c b/src/kdc/main.c index 979c2173a..c978a77a9 100644 --- a/src/kdc/main.c +++ b/src/kdc/main.c @@ -550,6 +550,8 @@ create_workers(verto_ctx *ctx, int num) for (i = 0; i < num; i++) { pid = fork(); if (pid == 0) { + verto_reinitialize(ctx); + /* Return control to main() in the new worker process. */ free(pids); return 0; diff --git a/src/lib/apputils/net-server.c b/src/lib/apputils/net-server.c index fc6d6e7c4..546ed769e 100644 --- a/src/lib/apputils/net-server.c +++ b/src/lib/apputils/net-server.c @@ -580,7 +580,9 @@ static verto_ev * add_udp_fd(struct socksetup *data, int sock, int pktinfo) { return add_fd(data, sock, pktinfo ? CONN_UDP_PKTINFO : CONN_UDP, - VERTO_EV_FLAG_IO_READ | VERTO_EV_FLAG_PERSIST, + VERTO_EV_FLAG_IO_READ | + VERTO_EV_FLAG_PERSIST | + VERTO_EV_FLAG_REINITIABLE, process_packet, 1); } @@ -588,7 +590,9 @@ static verto_ev * add_tcp_listener_fd(struct socksetup *data, int sock) { return add_fd(data, sock, CONN_TCP_LISTENER, - VERTO_EV_FLAG_IO_READ | VERTO_EV_FLAG_PERSIST, + VERTO_EV_FLAG_IO_READ | + VERTO_EV_FLAG_PERSIST | + VERTO_EV_FLAG_REINITIABLE, accept_tcp_connection, 1); } @@ -666,7 +670,9 @@ add_rpc_listener_fd(struct socksetup *data, struct rpc_svc_data *svc, int sock) verto_ev *ev; ev = add_fd(data, sock, CONN_RPC_LISTENER, - VERTO_EV_FLAG_IO_READ | VERTO_EV_FLAG_PERSIST, + VERTO_EV_FLAG_IO_READ | + VERTO_EV_FLAG_PERSIST | + VERTO_EV_FLAG_REINITIABLE, accept_rpc_connection, 1); if (ev == NULL) return NULL; -- 2.26.2