aboutsummaryrefslogtreecommitdiff
path: root/mfd/srvman.c
diff options
context:
space:
mode:
Diffstat (limited to 'mfd/srvman.c')
-rw-r--r--mfd/srvman.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/mfd/srvman.c b/mfd/srvman.c
index 47a5b54d..67433858 100644
--- a/mfd/srvman.c
+++ b/mfd/srvman.c
@@ -45,6 +45,7 @@ struct mfd_server {
socklen_t salen; /* Length of the sa */
int backlog; /* Backlog value for listen(2) */
int fd; /* Socket descriptor */
+ int flags; /* SRV_* flags */
mfd_server_prefork_hook_t prefork_hook; /* Pre-fork function */
mfd_server_func_t conn; /* Connection handler */
mfd_srvman_hook_t free_hook;
@@ -378,7 +379,7 @@ mfd_server_shutdown(struct mfd_server *srv)
}
struct mfd_server *
-mfd_server_new(const char *id, mu_url_t url, mfd_server_func_t conn)
+mfd_server_new(const char *id, mu_url_t url, mfd_server_func_t conn, int flags)
{
struct mfd_server *srv;
struct sockaddr *sa;
@@ -394,6 +395,7 @@ mfd_server_new(const char *id, mu_url_t url, mfd_server_func_t conn)
srv->salen = salen;
srv->backlog = 8;
srv->conn = conn;
+ srv->flags = flags;
return srv;
}
@@ -496,7 +498,7 @@ server_run(int connfd, struct mfd_server *srv,
if (srv->acl && check_acl(srv->id, srv->acl, sa, salen))
return;
- if (single_process_option) {
+ if (single_process_option || (srv->flags & SRV_SINGLE_PROCESS)) {
if ((!srvman_param.prefork_hook
|| srvman_param.prefork_hook(sa, salen,
srvman_param.data) == 0)
@@ -707,7 +709,8 @@ server_prep(struct mfd_server *srv, int fd)
mu_error(_("%s: file %s is not a socket"),
srv->id, s_un->sun_path);
return 1;
- } else if (force_remove) {
+ } else if (force_remove
+ || !(srv->flags & SRV_KEEP_EXISTING)) {
if (unlink(s_un->sun_path)) {
mu_error(_("%s: cannot unlink file %s: %s"),
srv->id, s_un->sun_path,
@@ -722,7 +725,7 @@ server_prep(struct mfd_server *srv, int fd)
break;
case AF_INET:
- if (force_remove) {
+ if (force_remove || !(srv->flags & SRV_KEEP_EXISTING)) {
t = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
&t, sizeof(t));

Return to:

Send suggestions and report system problems to the System administrator.