Просмотр исходного кода

* Updated egg_timer (sync 1.7 egg)
* Added cmd_timers() for future use
* Fixed some various bugs in cmd_chanset() and channel_modify()


svn: 735

Bryan Drewery 22 лет назад
Родитель
Сommit
a221100ee1

+ 24 - 8
src/cmds.c

@@ -14,6 +14,7 @@
 #include "net.h"
 #include "userrec.h"
 #include "users.h"
+#include "egg_timer.h"
 #include "userent.h"
 #include "tclhash.h"
 #include "match.h"
@@ -48,6 +49,7 @@ extern char		 origbotname[], ver[], network[],
 			 owner[], quit_msg[], dcc_prefix[], 
                          botname[], *binname, version[], egg_version[];
 extern time_t		 now, online_since, buildts;
+extern egg_timeval_t egg_timeval_now;
 extern module_entry	*module_list;
 extern struct cfg_entry	CFG_MOTD, **cfg;
 extern tand_t		*tandbot;
@@ -1851,6 +1853,22 @@ static void cmd_debug(struct userrec *u, int idx, char *par)
   tell_netdebug(idx);
 }
 
+static void cmd_timers(struct userrec *u, int idx, char *par)
+{
+  int *ids = 0, n = 0;
+  
+  if ((n = timer_list(&ids))) {
+    int i = 0;
+    char *name = NULL;
+
+    for (i = *ids; i <= n; i++) {
+      timer_info(i, &name, NULL, NULL);
+      dprintf(idx, "%d: %s\n", i, name);
+    }
+    free(ids);
+  }
+}
+
 static void cmd_simul(struct userrec *u, int idx, char *par)
 {
   char *nick = NULL;
@@ -2969,7 +2987,7 @@ static void cmd_newleaf(struct userrec *u, int idx, char *par)
         host = newsplit(&par);
       }
       /* set_user(&USERENTRY_PASS, u1, SALT2); */
-      sprintf(tmp, STR("%lu %s"), time(NULL), u->handle);
+      sprintf(tmp, STR("%lu %s"), now, u->handle);
       set_user(&USERENTRY_ADDED, u1, tmp);
       dprintf(idx, STR("Added new leaf: %s\n"), handle);
 #ifdef HUB
@@ -3132,7 +3150,7 @@ static void cmd_pls_user(struct userrec *u, int idx, char *par)
 
     userlist = adduser(userlist, handle, host, "-", USER_DEFAULT);
     u2 = get_user_by_handle(userlist, handle);
-    sprintf(tmp, STR("%lu %s"), time(NULL), u->handle);
+    sprintf(tmp, STR("%lu %s"), now, u->handle);
     set_user(&USERENTRY_ADDED, u2, tmp);
     dprintf(idx, STR("Added %s (%s) with no flags.\n"), handle, host);
     while (par[0]) {
@@ -3537,13 +3555,12 @@ void rcmd_msg(char * tobot, char * frombot, char * fromhand, char * fromidx, cha
 #ifdef HUB
 /* netlag */
 static void cmd_netlag(struct userrec * u, int idx, char * par) {
-  struct timeval tv;
   time_t tm;
   char tmp[64] = "";
 
   putlog(LOG_CMDS, "*", STR("#%s# netlag"), dcc[idx].nick);
-  gettimeofday(&tv, NULL);
-  tm = (tv.tv_sec % 10000) * 100 + (tv.tv_usec * 100) / (1000000);
+  
+  tm = (egg_timeval_now.sec % 10000) * 100 + (egg_timeval_now.usec * 100) / (1000000);
   sprintf(tmp, STR("ping %lu"), tm);
   dprintf(idx, STR("Sent ping to all linked bots\n"));
   botnet_send_cmd_broad(-1, conf.bot->nick, u->handle, idx, tmp);
@@ -3561,11 +3578,9 @@ void rcmd_pong(char *frombot, char *fromhand, char *fromidx, char *par) {
   int i = atoi(fromidx);
 
   if ((i >= 0) && (i < dcc_total) && (dcc[i].type == &DCC_CHAT) && (!strcmp(dcc[i].nick, fromhand))) {
-    struct timeval tv;
     time_t tm;
 
-    gettimeofday(&tv, NULL);
-    tm = ((tv.tv_sec % 10000) * 100 + (tv.tv_usec * 100) / (1000000)) - atoi(par);
+    tm = ((egg_timeval_now.sec % 10000) * 100 + (egg_timeval_now.usec * 100) / (1000000)) - atoi(par);
     dprintf(i, STR("Pong from %s: %i.%i seconds\n"), frombot, (tm / 100), (tm % 100));
   }
 }
@@ -4047,6 +4062,7 @@ cmd_t C_dcc[] =
   {"dccstat",		"a",	(Function) cmd_dccstat,		NULL},
 #endif /* HUB */
   {"debug",		"a",	(Function) cmd_debug,		NULL},
+  {"timers",		"a",	(Function) cmd_timers,		NULL},
   {"die",		"n",	(Function) cmd_die,		NULL},
   {"echo",		"",	(Function) cmd_echo,		NULL},
   {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL},

+ 131 - 54
src/egg_timer.c

@@ -4,10 +4,14 @@
 
 #include "egg_timer.h"
 
+/* From main.c */
+static egg_timeval_t now;
+
 /* Internal use only. */
 typedef struct egg_timer_b {
 	struct egg_timer_b *next;
 	int id;
+	char *name;
 	Function callback;
 	void *client_data;
 	egg_timeval_t howlong;
@@ -17,45 +21,77 @@ typedef struct egg_timer_b {
 
 /* We keep a sorted list of active timers. */
 static egg_timer_t *timer_list_head = NULL;
-static unsigned int timer_next_id = 1;
+static int timer_next_id = 1;
 
 /* Based on TclpGetTime from Tcl 8.3.3 */
 int timer_get_time(egg_timeval_t *curtime)
 {
 	struct timeval tv;
-	struct timezone tz;
 
-	(void) gettimeofday(&tv, &tz);
+	(void) gettimeofday(&tv, NULL);
 	curtime->sec = tv.tv_sec;
 	curtime->usec = tv.tv_usec;
 	return(0);
 }
 
-int timer_create_complex(egg_timeval_t *howlong, Function callback, void *client_data, int flags)
+int timer_update_now(egg_timeval_t *_now)
 {
-	egg_timer_t *timer = NULL, *prev = NULL;
-	egg_timeval_t trigger_time;
+	timer_get_time(&now);
+	if (_now) {
+		_now->sec = now.sec;
+		_now->usec = now.usec;
+	}
+	return(now.sec);
+}
 
-	timer_get_time(&trigger_time);
-	trigger_time.sec += howlong->sec;
-	trigger_time.usec += howlong->usec;
 
-	/* Find out where this should go in the list. */
-	prev = NULL;
-	for (timer = timer_list_head; timer; timer = timer->next) {
-		if (trigger_time.sec < timer->trigger_time.sec) break;
-		if (trigger_time.sec == timer->trigger_time.sec && trigger_time.usec < timer->trigger_time.usec) break;
-		prev = timer;
+void timer_get_now(egg_timeval_t *_now)
+{
+	_now->sec = now.sec;
+	_now->usec = now.usec;
+}
+
+int timer_get_now_sec(int *sec)
+{
+	if (sec) *sec = now.sec;
+	return(now.sec);
+}
+
+
+/* Find difference between two timers. */
+int timer_diff(egg_timeval_t *from_time, egg_timeval_t *to_time, egg_timeval_t *diff)
+{
+	diff->sec = to_time->sec - from_time->sec;
+	if (diff->sec < 0) {
+		diff->sec = 0;
+		diff->usec = 0;
+		return(1);
 	}
 
-	/* Fill out a new timer. */
-	timer = (egg_timer_t *) calloc(1, sizeof(*timer));
-	timer->callback = callback;
-	timer->client_data = client_data;
-	timer->flags = flags;
-	egg_memcpy(&timer->howlong, howlong, sizeof(*howlong));
-	egg_memcpy(&timer->trigger_time, &trigger_time, sizeof(trigger_time));
-	timer->id = timer_next_id++;
+	diff->usec = to_time->usec - from_time->usec;
+
+	if (diff->usec < 0) {
+		if (diff->sec == 0) {
+			diff->usec = 0;
+			return(1);
+		}
+		diff->sec -= 1;
+		diff->usec += 1000000;
+	}
+
+	return(0);
+}
+
+static int timer_add_to_list(egg_timer_t *timer)
+{
+	egg_timer_t *prev = NULL, *ptr = NULL;
+
+	/* Find out where this should go in the list. */
+	for (ptr = timer_list_head; ptr; ptr = ptr->next) {
+		if (timer->trigger_time.sec < ptr->trigger_time.sec) break;
+		if (timer->trigger_time.sec == ptr->trigger_time.sec && timer->trigger_time.usec < ptr->trigger_time.usec) break;
+		prev = ptr;
+	}
 
 	/* Insert into timer list. */
 	if (prev) {
@@ -66,8 +102,27 @@ int timer_create_complex(egg_timeval_t *howlong, Function callback, void *client
 		timer->next = timer_list_head;
 		timer_list_head = timer;
 	}
+	return(0);
+}
 
-	if (timer_next_id == 0) timer_next_id++;
+int timer_create_complex(egg_timeval_t *howlong, const char *name, Function callback, void *client_data, int flags)
+{
+	egg_timer_t *timer = NULL;
+
+	/* Fill out a new timer. */
+	timer = (egg_timer_t *)calloc(1, sizeof(*timer));
+	timer->id = timer_next_id++;
+	if (name) timer->name = strdup(name);
+	else timer->name = NULL;
+	timer->callback = callback;
+	timer->client_data = client_data;
+	timer->flags = flags;
+	timer->howlong.sec = howlong->sec;
+	timer->howlong.usec = howlong->usec;
+	timer->trigger_time.sec = now.sec + howlong->sec;
+	timer->trigger_time.usec = now.usec + howlong->usec;
+
+	timer_add_to_list(timer);
 
 	return(timer->id);
 }
@@ -80,6 +135,7 @@ int timer_destroy(int timer_id)
 	prev = NULL;
 	for (timer = timer_list_head; timer; timer = timer->next) {
 		if (timer->id == timer_id) break;
+		prev = timer;
 	}
 
 	if (!timer) return(1); /* Not found! */
@@ -88,16 +144,17 @@ int timer_destroy(int timer_id)
 	if (prev) prev->next = timer->next;
 	else timer_list_head = timer->next;
 
+	if (timer->name) free(timer->name);
 	free(timer);
 	return(0);
 }
 
 int timer_destroy_all()
 {
-	egg_timer_t *timer = NULL;
+	egg_timer_t *timer = NULL, *next = NULL;
 
-	for (timer = timer_list_head; timer; timer = timer->next) {
-		free(timer);
+	for (timer = timer_list_head; timer; timer = next) {
+		next = timer->next;
 	}
 	timer_list_head = NULL;
 	return(0);
@@ -105,33 +162,26 @@ int timer_destroy_all()
 
 int timer_get_shortest(egg_timeval_t *howlong)
 {
-	egg_timeval_t curtime;
 	egg_timer_t *timer = timer_list_head;
 
 	/* No timers? Boo. */
 	if (!timer) return(1);
 
-	timer_get_time(&curtime);
-
-	if (timer->trigger_time.sec <= curtime.sec) howlong->sec = 0;
-	else howlong->sec = timer->trigger_time.sec - curtime.sec;
-
-	if (timer->trigger_time.usec <= curtime.usec) howlong->usec = 0;
-	else howlong->usec = timer->trigger_time.usec - curtime.usec;
-
+	timer_diff(&now, &timer->trigger_time, howlong);
 	return(0);
 }
 
 int timer_run()
 {
-	egg_timeval_t curtime;
 	egg_timer_t *timer = NULL;
 	Function callback;
 	void *client_data = NULL;
 
-	while ((timer = timer_list_head)) {
-		timer_get_time(&curtime);
-		if (timer->trigger_time.sec > curtime.sec || (timer->trigger_time.sec == curtime.sec && timer->trigger_time.usec > curtime.usec)) break;
+	while (timer_list_head) {
+		timer = timer_list_head;
+
+		if (timer->trigger_time.sec > now.sec || 
+			(timer->trigger_time.sec == now.sec && timer->trigger_time.usec > now.usec)) break;
 
 		timer_list_head = timer_list_head->next;
 
@@ -139,30 +189,57 @@ int timer_run()
 		client_data = timer->client_data;
 
 		if (timer->flags & TIMER_REPEAT) {
-			egg_timer_t *prev, *tptr;
-
 			/* Update timer. */
 			timer->trigger_time.sec += timer->howlong.sec;
 			timer->trigger_time.usec += timer->howlong.usec;
 
-			prev = NULL;
-			for (tptr = timer_list_head; tptr; tptr = tptr->next) {
-				if (tptr->trigger_time.sec > timer->trigger_time.sec || (tptr->trigger_time.sec == timer->trigger_time.sec && tptr->trigger_time.usec > timer->trigger_time.usec)) break;
-				prev = tptr;
-			}
-			if (prev) {
-				timer->next = prev->next;
-				prev->next = timer;
-			}
-			else {
-				timer->next = timer_list_head;
-				timer_list_head = timer;
+			if (timer->trigger_time.usec >= 1000000) {
+				timer->trigger_time.usec -= 1000000;
+				timer->trigger_time.sec += 1;
 			}
+
+			/* Add it back into the list. */
+			timer_add_to_list(timer);
 		}
 		else {
+			if (timer->name) free(timer->name);
 			free(timer);
 		}
+
 		callback(client_data);
 	}
 	return(0);
 }
+
+int timer_list(int **ids)
+{
+	egg_timer_t *timer = NULL;
+	int ntimers = 0;
+
+	/* Count timers. */
+	for (timer = timer_list_head; timer; timer = timer->next) ntimers++;
+
+	/* Fill in array. */
+	*ids = malloc(sizeof(int) * (ntimers+1));
+	ntimers = 0;
+	for (timer = timer_list_head; timer; timer = timer->next) {
+		(*ids)[ntimers++] = timer->id;
+	}
+	return(ntimers);
+}
+
+int timer_info(int id, char **name, egg_timeval_t *initial_len, egg_timeval_t *trigger_time)
+{
+        egg_timer_t *timer = NULL;
+
+        for (timer = timer_list_head; timer; timer = timer->next) {
+                if (timer->id == id) break;
+        }
+        if (!timer) return(-1);
+	if (name) *name = timer->name;
+        if (initial_len) memcpy(initial_len, &timer->howlong, sizeof(*initial_len));
+        if (trigger_time) memcpy(trigger_time, &timer->trigger_time, sizeof(*trigger_time));
+        return(0);
+}
+
+

+ 9 - 4
src/egg_timer.h

@@ -11,16 +11,21 @@ typedef struct egg_timeval_b {
 #define TIMER_REPEAT 1
 
 /* Create a simple timer with no client data and no flags. */
-#define timer_create(howlong,callback) timer_create_complex(howlong, callback, NULL, 0)
+#define timer_create(howlong,name,callback) timer_create_complex(howlong, name, callback, NULL, 0)
 
 /* Create a simple timer with no client data, but it repeats. */
-#define timer_create_repeater(howlong,callback) timer_create_complex(howlong, callback, NULL, TIMER_REPEAT)
+#define timer_create_repeater(howlong,name,callback) timer_create_complex(howlong, name, callback, NULL, TIMER_REPEAT)
 
 int timer_get_time(egg_timeval_t *curtime);
-int timer_create_complex(egg_timeval_t *howlong, Function callback, void *client_data, int flags);
+void timer_get_now(egg_timeval_t *_now);
+int timer_get_now_sec(int *sec);
+int timer_update_now(egg_timeval_t *_now);
+int timer_diff(egg_timeval_t *from_time, egg_timeval_t *to_time, egg_timeval_t *diff);
+int timer_create_complex(egg_timeval_t *howlong, const char *name, Function callback, void *client_data, int flags);
 int timer_destroy(int timer_id);
 int timer_destroy_all();
 int timer_get_shortest(egg_timeval_t *howlong);
 int timer_run();
-
+int timer_list(int **ids);
+int timer_info(int id, char **name, egg_timeval_t *initial_len, egg_timeval_t *trigger_time);
 #endif /* _EGG_TIMER_H_ */

+ 9 - 10
src/main.c

@@ -100,6 +100,7 @@ int	use_stderr = 1;		/* Send stuff to stderr instead of logfiles? */
 int	do_restart = 0;		/* .restart has been called, restart asap */
 char	quit_msg[1024];		/* quit message */
 time_t	now;			/* duh, now :) */
+egg_timeval_t egg_timeval_now;	/* Same thing, but seconds and microseconds. */
 
 extern struct cfg_entry CFG_FORKINTERVAL;
 
@@ -369,7 +370,6 @@ static void dtx_arg(int argc, char *argv[])
 
 /* Timer info */
 static int		lastmin = 99;
-static time_t		then;
 static struct tm	nowtm;
 
 int curcheck = 0;
@@ -683,7 +683,9 @@ int main(int argc, char **argv)
 
   Context;
   /* Initialize variables and stuff */
-  now = time(NULL);
+  timer_update_now(&egg_timeval_now);
+  now = egg_timeval_now.sec;
+
 #ifdef S_UTCTIME
   egg_memcpy(&nowtm, gmtime(&now), sizeof(struct tm));
 #else /* !S_UTCTIME */
@@ -841,12 +843,11 @@ int main(int argc, char **argv)
     dcc_chatter(n);
   }
 
-  then = now;
   online_since = now;
   autolink_cycle(NULL);		/* Hurry and connect to tandem bots */
   howlong.sec = 1;
   howlong.usec = 0;
-  timer_create_repeater(&howlong, (Function) core_secondly);
+  timer_create_repeater(&howlong, "core_secondly()", (Function) core_secondly);
   add_hook(HOOK_10SECONDLY, (Function) core_10secondly);
   add_hook(HOOK_30SECONDLY, (Function) expire_simuls);
   add_hook(HOOK_MINUTELY, (Function) core_minutely);
@@ -866,12 +867,10 @@ int main(int argc, char **argv)
     /* Lets move some of this here, reducing the numer of actual
      * calls to periodic_timers
      */
-    now = time(NULL);
+    timer_update_now(&egg_timeval_now);
+    now = egg_timeval_now.sec;
+    random();			/* jumble things up o_O */
     timer_run();
-    if (now != then) {		/* Once a second */
-/*      call_hook(HOOK_SECONDLY); */
-      then = now;
-    }
 
     /* Only do this every so often. */
     if (!socket_cleanup) {
@@ -886,7 +885,7 @@ int main(int argc, char **argv)
       socket_cleanup--;
 
     xx = sockgets(buf, &i); 
-    /* "chanprog()" bug is down here somewhere.... */
+
     if (xx >= 0) {		/* Non-error */
       int idx;
 

+ 1 - 1
src/mod/channels.mod/channels.c

@@ -138,7 +138,7 @@ static void got_cset(char *botnick, char *code, char *par)
     chname = chan->dname;
     do_chanset(NULL, chan, par, DO_LOCAL);
     if (chan->status & CHAN_BITCH) {
-      module_entry *me;
+      module_entry *me = NULL;
       if ((me = module_find("irc", 0, 0)))
         (me->funcs[IRC_RECHECK_CHANNEL])(chan, 0);
     }

+ 1 - 1
src/mod/channels.mod/cmdschan.c

@@ -1762,7 +1762,7 @@ static void cmd_chanset(struct userrec *u, int idx, char *par)
       return;
     }
   }
-  if (do_chanset(result, all ? chan : NULL, par, DO_LOCAL) == ERROR) {
+  if (do_chanset(result, all ? NULL : chan, par, DO_LOCAL | DO_NET) == ERROR) {
     dprintf(idx, "Error trying to set { %s } on %s: %s\n", par, all ? "all channels" : chan->dname, result);
     return;
   }

+ 10 - 20
src/mod/channels.mod/tclchan.c

@@ -624,34 +624,24 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
       }
     }
   }
-  /* If protect_readonly == 0 and loading == 0 then
-   * bot is now processing the configfile, so dont do anything,
-   * we've to wait the channelfile that maybe override these settings
-   * (note: it may cause problems if there is no chanfile!)
-   * <drummer/1999/10/21>
-   */
 #ifdef LEAF
-  if (loading) {
-    if (((old_status ^ chan->status) & CHAN_INACTIVE) &&
-	module_find("irc", 0, 0)) {
-      if (!shouldjoin(chan) &&
-	  (chan->status & (CHAN_ACTIVE | CHAN_PEND)))
-	dprintf(DP_SERVER, "PART %s\n", chan->name);
-      if (shouldjoin(chan) &&
-	  !(chan->status & (CHAN_ACTIVE | CHAN_PEND)))
+  if (1 || loading) {
+    if (((old_status ^ chan->status) & CHAN_INACTIVE) && module_find("irc", 0, 0)) {
+      if (!shouldjoin(chan) && (chan->status & (CHAN_ACTIVE | CHAN_PEND)))
+        dprintf(DP_SERVER, "PART %s\n", chan->name);
+      if (shouldjoin(chan) && !(chan->status & (CHAN_ACTIVE | CHAN_PEND)))
 	dprintf(DP_SERVER, "JOIN %s %s\n", (chan->name[0]) ?
 					   chan->name : chan->dname,
 					   chan->channel.key[0] ?
 					   chan->channel.key : chan->key_prot);
     }
-    if ((old_status ^ chan->status) & (CHAN_ENFORCEBANS |
-	CHAN_BITCH)) {
+    if ((old_status ^ chan->status) & (CHAN_ENFORCEBANS | CHAN_BITCH)) {
       if ((me = module_find("irc", 0, 0)))
         (me->funcs[IRC_RECHECK_CHANNEL])(chan, 1);
-    } else if (old_mode_pls_prot != chan->mode_pls_prot ||
-	       old_mode_mns_prot != chan->mode_mns_prot)
-    if ((me = module_find("irc", 0, 0)))
-      (me->funcs[IRC_RECHECK_CHANNEL_MODES])(chan);
+    } else if (old_mode_pls_prot != chan->mode_pls_prot || old_mode_mns_prot != chan->mode_mns_prot) {
+      if ((me = module_find("irc", 0, 0)))
+        (me->funcs[IRC_RECHECK_CHANNEL_MODES])(chan);
+    }
   }
 #endif /* LEAF */
   if (x > 0)

+ 3 - 3
src/mod/ctcp.mod/ctcp.c

@@ -392,20 +392,20 @@ static void ctcp_minutely()
 
 #ifdef S_AUTOAWAY
   if ((cloak_awaytime == 0) && (cloak_heretime == 0)) {
-    cloak_heretime = time(NULL);
+    cloak_heretime = now;
     dprintf(DP_HELP, STR("AWAY :\n"));
     return;
   }
   if (cloak_awaytime == 0) {
     if (!randint(AVGHERETIME)) {
       cloak_heretime = 0;
-      cloak_awaytime = time(NULL) - 600 - randint(60);
+      cloak_awaytime = now - 600 - randint(60);
       sendaway();
     }
   } else {
     if (!randint(AVGAWAYTIME)) {
       cloak_awaytime = 0;
-      cloak_heretime = time(NULL);
+      cloak_heretime = now;
       dprintf(DP_HELP, STR("AWAY :\n"));
     } else
       sendaway();

+ 1 - 1
src/mod/dns.mod/coredns.c

@@ -595,7 +595,7 @@ static void sendrequest(struct resolve *rp, int type)
 {
     /* Create unique id */
     do {
-	idseed = (((idseed + idseed) | (long) time(NULL))
+	idseed = (((idseed + idseed) | (long) now)
 		  + idseed - 0x54bad4a) ^ aseed;
 	aseed ^= idseed;
 	rp->id = (u_16bit_t) idseed;

+ 1 - 1
src/mod/irc.mod/cmdsirc.c

@@ -1494,7 +1494,7 @@ static void cmd_adduser(struct userrec *u, int idx, char *par)
   if (!u) {
     userlist = adduser(userlist, hand, p1, "-", USER_DEFAULT);
     u = get_user_by_handle(userlist, hand);
-    sprintf(tmp, STR("%lu %s"), time(NULL), dcc[idx].nick);
+    sprintf(tmp, STR("%lu %s"), now, dcc[idx].nick);
     set_user(&USERENTRY_ADDED, u, tmp);
     make_rand_str(s2, 15);
     set_user(&USERENTRY_PASS, u, s2);

+ 2 - 2
src/mod/irc.mod/irc.c

@@ -496,7 +496,7 @@ static void request_op(struct chanset_t *chan)
     return;
   }
   /* max OPREQ_COUNT requests per OPREQ_SECONDS sec */
-  n = time(NULL);
+  n = now;
   while (i < 5) {
     if (n - chan->opreqtime[i] > OPREQ_SECONDS) {
       if (first > i)
@@ -941,7 +941,7 @@ static void reset_chan_info(struct chanset_t *chan)
 
   /* Don't reset the channel if we're already resetting it */
   if (!shouldjoin(chan)) {
-    dprintf(DP_MODE,"PART %s\n", chan->name);
+    dprintf(DP_MODE, "PART %s\n", chan->name);
     return;
   }
   if (!channel_pending(chan)) {

+ 1 - 1
src/net.c

@@ -185,7 +185,7 @@ int seed_PRNG(void)
     return 1;
   if (!RAND_load_file(rand_file, 1024)) {
     unsigned int c;
-    c = time(NULL);
+    c = now;
     RAND_seed(&c, sizeof(c));
     c = getpid();
     RAND_seed(&c, sizeof(c));

+ 1 - 1
src/tclhash.c

@@ -67,7 +67,7 @@ static void schedule_bind_cleanup()
 
 	when.sec = 0;
 	when.usec = 0;
-	timer_create(&when, internal_bind_cleanup);
+	timer_create(&when, "internal_bind_cleanup", internal_bind_cleanup);
 }