summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2019-06-29 15:57:44 +0200
committerAlexander Barton <alex@barton.de>2019-06-29 16:00:53 +0200
commitbb1d014abad85b6938cf9d3e88e64f4ee6757ede (patch)
tree9cdabfcde0f7cdb5163998df67ae61b55deae7e6 /src
parentad8c4b8efb4c77c961516db6ed8917a6421e3d56 (diff)
downloadngircd-bb1d014abad85b6938cf9d3e88e64f4ee6757ede.tar.gz
ngircd-bb1d014abad85b6938cf9d3e88e64f4ee6757ede.zip
Slightly reoder startup steps, and enhance logging
- Show name of configuration file at the beginning of start up.
- Add a message when ngIRCd is ready, including its host name.
- Show name of configuration file on REHASH (SIGHUP), too.
- Change level of "done message" to NOTICE, like "starting" & "ready".
- Initialize IO functions before channels, connections, clients, ...
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/conf.c4
-rw-r--r--src/ngircd/conn.c5
-rw-r--r--src/ngircd/log.c7
-rw-r--r--src/ngircd/ngircd.c17
4 files changed, 17 insertions, 16 deletions
diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
index 3f2e0154..59a8ef9e 100644
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2018 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2019 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -902,6 +902,8 @@ Read_Config(bool TestOnly, bool IsStarting)
 	FILE *fd;
 	DIR *dh;
 
+	Log(LOG_INFO, "Using configuration file \"%s\" ...", NGIRCd_ConfFile);
+
 	/* Open configuration file */
 	fd = fopen( NGIRCd_ConfFile, "r" );
 	if( ! fd ) {
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 69567769..f62e9675 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2018 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2019 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -660,6 +660,9 @@ Conn_Handler(void)
 	struct timeval tv;
 	time_t t;
 
+	Log(LOG_NOTICE, "Server \"%s\" (on \"%s\") ready.",
+	    Client_ID(Client_ThisServer()), Client_Hostname(Client_ThisServer()));
+
 	while (!NGIRCd_SignalQuit && !NGIRCd_SignalRestart) {
 		t = time(NULL);
 
diff --git a/src/ngircd/log.c b/src/ngircd/log.c
index 8b39e602..a47ce92c 100644
--- a/src/ngircd/log.c
+++ b/src/ngircd/log.c
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2019 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -80,6 +80,7 @@ Log_Init(bool Daemon_Mode)
 	openlog(PACKAGE, LOG_CONS|LOG_PID, 0);
 #endif
 #endif
+	Log(LOG_NOTICE, "%s starting ...", NGIRCd_Version);
 } /* Log_Init */
 
 
@@ -96,15 +97,13 @@ Log_ReInit(void)
 	closelog();
 	openlog(PACKAGE, LOG_CONS|LOG_PID, Conf_SyslogFacility);
 #endif
-	Log(LOG_NOTICE, "%s started.", NGIRCd_Version);
-	Log(LOG_INFO, "Using configuration file \"%s\" ...", NGIRCd_ConfFile);
 }
 
 
 GLOBAL void
 Log_Exit( void )
 {
-	Log(LOG_INFO, "%s done%s, served %lu connection%s.", PACKAGE_NAME,
+	Log(LOG_NOTICE, "%s done%s, served %lu connection%s.", PACKAGE_NAME,
 	    NGIRCd_SignalRestart ? " (restarting)" : "", Conn_CountAccepted(),
 	    Conn_CountAccepted() == 1 ? "" : "s");
 #ifdef SYSLOG
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
index f73aa505..78477e52 100644
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -246,26 +246,18 @@ main(int argc, const char *argv[])
 		NGIRCd_SignalRestart = false;
 		NGIRCd_SignalQuit = false;
 
-		/* Initialize modules, part I */
 		Log_Init(!NGIRCd_NoDaemon);
 		Random_Init();
 		Conf_Init();
 		Log_ReInit();
 
-		/* Initialize the "main program": chroot environment, user and
-		 * group ID, ... */
+		/* Initialize the "main program":
+		 * chroot environment, user and group ID, ... */
 		if (!NGIRCd_Init(NGIRCd_NoDaemon)) {
 			Log(LOG_ALERT, "Fatal: Initialization failed, exiting!");
 			exit(1);
 		}
 
-		/* Initialize modules, part II: these functions are eventually
-		 * called with already dropped privileges ... */
-		Channel_Init();
-		Client_Init();
-		Conn_Init();
-		Class_Init();
-
 		if (!io_library_init(CONNECTION_POOL)) {
 			Log(LOG_ALERT,
 			    "Fatal: Could not initialize IO routines: %s",
@@ -280,6 +272,11 @@ main(int argc, const char *argv[])
 			exit(1);
 		}
 
+		Channel_Init();
+		Conn_Init();
+		Class_Init();
+		Client_Init();
+
 		/* Create protocol and server identification. The syntax
 		 * used by ngIRCd in PASS commands and the known "extended
 		 * flags" are described in doc/Protocol.txt. */