Răsfoiți Sursa

* Fix 'cmd_rehash' problems on hubs

Bryan Drewery 17 ani în urmă
părinte
comite
e92a162879
4 a modificat fișierele cu 17 adăugiri și 10 ștergeri
  1. 1 0
      doc/UPDATES
  2. 14 9
      src/chanprog.c
  3. 1 0
      src/chanprog.h
  4. 1 1
      src/main.c

+ 1 - 0
doc/UPDATES

@@ -28,6 +28,7 @@
 * Disable bot +f as all it did was cause a segfault. The flood code is unfinished. (fixes #429)
 * Fix cmd_slowjoin not counting bots correctly. (fixes #431)
 * Added telnet 'tcl expect' script in scripts/telnet.exp. Can be used for easier hub management over telnet from shell.
+* Fix 'cmd_rehash' problems on hubs.
 
 1.2.15.1
 * Fix leaf bots not updating behind other hubs (fixes #419)

+ 14 - 9
src/chanprog.c

@@ -541,10 +541,7 @@ void add_myself_to_userlist() {
   }
 }
 
-void chanprog()
-{
-  struct utsname un;
-
+void rehash_ip() {
   /* cache our ip on load instead of every 30 seconds */
   char *ip4 = NULL, *ip6 = NULL;
 
@@ -571,6 +568,18 @@ void chanprog()
     free(ip6);
   }
 
+  if (conf.bot->hub) {
+    struct bot_addr *bi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, conf.bot->u);
+    listen_all(bi->telnet_port, 0);
+    my_port = bi->telnet_port;
+  }
+}
+
+void chanprog()
+{
+  struct utsname un;
+
+
   sdprintf("I am: %s", conf.bot->nick);
   if (conf.bot->hub) {
     simple_snprintf(userfile, 121, "%s/.u", conf.binpath);
@@ -586,11 +595,7 @@ void chanprog()
 
   add_myself_to_userlist();
 
-  if (conf.bot->hub) {
-    struct bot_addr *bi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, conf.bot->u);
-    listen_all(bi->telnet_port, 0);
-    my_port = bi->telnet_port;
-  }
+  rehash_ip();
 
   /* set our shell info */
   uname(&un);

+ 1 - 0
src/chanprog.h

@@ -16,6 +16,7 @@ int isowner(char *);
 void reaffirm_owners();
 void reload();
 void chanprog();
+void rehash_ip();
 void check_timers();
 void check_utimers();
 void rmspace(char *s);

+ 1 - 1
src/main.c

@@ -1048,7 +1048,7 @@ printf("out: %s\n", out);
         restart(-1);
       else { //rehash()
         reload_bin_data();
-        chanprog();
+        rehash_ip();
       }
       do_restart = 0;
     }