server: Don't pass peername to handle_connect().
[paraslash.git] / server.c
index 4bc85a345b6328041059da62443a0d544371e324..c9605d2f7b94e0a7b64372469ce1713154a749d0 100644 (file)
--- a/server.c
+++ b/server.c
@@ -1,8 +1,4 @@
-/*
- * Copyright (C) 1997 Andre Noll <maan@tuebingen.mpg.de>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* Copyright (C) 1997 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
 
 /** \file server.c Paraslash's main server. */
 
@@ -196,7 +192,6 @@ void parse_config_or_die(bool reload)
                        goto free_cf;
                if (ret == -ERRNO_TO_PARA_ERROR(ENOENT) && OPT_GIVEN(CONFIG_FILE))
                        goto free_cf;
-               ret = 0;
                server_lpr = cmdline_lpr;
                goto success;
        }
@@ -212,7 +207,7 @@ void parse_config_or_die(bool reload)
        if (reload) /* config file overrides command line */
                ret = lls(lls_merge(cf_lpr, cmdline_lpr, CMD_PTR, &merged_lpr,
                        &errctx));
-       else /* command line options overrride config file options */
+       else /* command line options override config file options */
                ret = lls(lls_merge(cmdline_lpr, cf_lpr, CMD_PTR, &merged_lpr,
                        &errctx));
        lls_free_parse_result(cf_lpr, CMD_PTR);
@@ -357,8 +352,6 @@ static int command_post_select(struct sched *s, void *context)
        ret = para_accept(sct->listen_fd, &s->rfds, NULL, 0, &new_fd);
        if (ret <= 0)
                goto out;
-       peer_name = remote_name(new_fd);
-       PARA_INFO_LOG("got connection from %s, forking\n", peer_name);
        mmd->num_connects++;
        mmd->active_connections++;
        /*
@@ -384,6 +377,8 @@ static int command_post_select(struct sched *s, void *context)
                /* parent keeps accepting connections */
                return 0;
        }
+       peer_name = remote_name(new_fd);
+       PARA_INFO_LOG("accepted connection from %s\n", peer_name);
        /* mmd might already have changed at this point */
        free(chunk_table);
        alarm(ALARM_TIMEOUT);
@@ -397,7 +392,7 @@ static int command_post_select(struct sched *s, void *context)
                memset(sct->argv[i], 0, strlen(sct->argv[i]));
        i = sct->argc - 1 - lls_num_inputs(cmdline_lpr);
        sprintf(sct->argv[i], "para_server (serving %s)", peer_name);
-       handle_connect(new_fd, peer_name);
+       handle_connect(new_fd);
        /* never reached*/
 out:
        if (ret < 0)