1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-29 15:26:38 +02:00

- Made the timesynch log output more clear and understandable.

- Added an 'UnrealIRCd started' log message on startup.
This commit is contained in:
Bram Matthys
2009-12-06 16:31:42 +00:00
parent 829247a272
commit a5bd782cdf
3 changed files with 22 additions and 5 deletions
+2
View File
@@ -1848,3 +1848,5 @@
This change should not break extban modules, and should need some more extensive testing.
- Misc fix for disabling extban chains, should've done stuff in our autoconf
stuff instead of hacking configure directly :P .
- Made the timesynch log output more clear and understandable.
- Added an 'UnrealIRCd started' log message on startup.
+4 -1
View File
@@ -1536,6 +1536,7 @@ int InitwIRCD(int argc, char *argv[])
me.umodes = conf_listen->options;
conf_listen->listener = &me;
run_configuration();
ircd_log(LOG_ERROR, "UnrealIRCd started.");
botmotd = (aMotd *) read_file(conf_files->botmotd_file, NULL);
rules = (aMotd *) read_file(conf_files->rules_file, NULL);
opermotd = (aMotd *) read_file(conf_files->opermotd_file, NULL);
@@ -1623,7 +1624,9 @@ int InitwIRCD(int argc, char *argv[])
if (TIMESYNCH)
{
if (!unreal_time_synch(TIMESYNCH_TIMEOUT))
ircd_log(LOG_ERROR, "TIME SYNCH: Unable to synchronize time: %s. This happens sometimes, no error on your part.",
ircd_log(LOG_ERROR, "TIME SYNCH: Unable to synchronize time: %s. "
"This means UnrealIRCd was unable to synchronize the IRCd clock to a known good time source. "
"As long as the server owner keeps the server clock synchronized through NTP, everything will be fine.",
unreal_time_synch_error());
}
fix_timers(); /* Fix timers AFTER reading tune file AND timesynch */
+16 -4
View File
@@ -156,6 +156,7 @@ int n, addrlen, i, highestfd = 0;
fd_set r;
struct timeval tv;
char buf[512], *buf_out;
int succesfully_sent = 0;
strlcpy(tmptimeservbuf, TIMESYNCH_SERVER, sizeof(tmptimeservbuf));
@@ -193,10 +194,18 @@ char buf[512], *buf_out;
{
n = sendto(s[i], buf_out, TSPKTLEN, 0, (struct sockaddr *)&addr[i], sizeof(struct sockaddr_in));
if (n < 0)
ircd_log(LOG_ERROR, "TimeSync: WARNING: Was unable to send message to server #%d...", i);
ircd_log(LOG_ERROR, "TimeSync: WARNING: Was unable to send packet to server #%d... ", i);
else
succesfully_sent++;
}
if (!succesfully_sent)
{
ircd_log(LOG_ERROR, "TimeSync: WARNING: Unable to send time synchronization packets to ANY time server. "
"Perhaps your firewall is blocking outgoing packets to UDP port 123?");
strcpy(tserr, "Unable to send packets");
goto end;
}
start = time(NULL); /* yes, indeed.. not TStime() here.. that is correct */
@@ -260,8 +269,11 @@ gotit:
now = time(NULL);
offset = t - now;
ircd_log(LOG_ERROR, "TIME SYNCH: timeserver=%ld, our=%ld, offset = %ld [old offset: %ld]\n",
(long)t, (long)now, (long)offset, (long)TSoffset);
if ((offset >= -1) && (offset <= 1)) /* no offset (or only +1/-1) */
ircd_log(LOG_ERROR, "TIME SYNCH: IRCd clock succesfully synchronized to known good time source.");
else
ircd_log(LOG_ERROR, "TIME SYNCH: IRCd clock succesfully synchronized to known good time source [offset: %ld, was: %ld].",
(long)offset, (long)TSoffset);
TSoffset = offset;