Selaa lähdekoodia

* Don't rewrite binary / notify bots if the hubs didn't change

Bryan Drewery 14 vuotta sitten
vanhempi
commit
8803fefb37
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. 6 1
      src/conf.c

+ 6 - 1
src/conf.c

@@ -1024,7 +1024,7 @@ bin_to_conf(bool error)
 }
 }
 
 
 void conf_update_hubs(struct userrec* list) {
 void conf_update_hubs(struct userrec* list) {
-  bd::Array<bd::String> hubUsers;
+  bd::Array<bd::String> hubUsers, oldhubs(conf.hubs);
 
 
   // Count how many hubs there are
   // Count how many hubs there are
   for (struct userrec *u = list; u; u = u->next) {
   for (struct userrec *u = list; u; u = u->next) {
@@ -1041,6 +1041,11 @@ void conf_update_hubs(struct userrec* list) {
     conf.hubs << bd::String::printf("%s %s %d %d", u->handle, bi->address, bi->telnet_port, bi->hublevel);
     conf.hubs << bd::String::printf("%s %s %d %d", u->handle, bi->address, bi->telnet_port, bi->hublevel);
   }
   }
 
 
+  // Only rewrite binary / notify bots if the hubs changed
+  if (conf.hubs == oldhubs) {
+    return;
+  }
+
   if (conf.bot->hub || conf.bot->localhub) {
   if (conf.bot->hub || conf.bot->localhub) {
     /* rewrite our binary */
     /* rewrite our binary */
     conf_to_bin(&conf, 0, -1);
     conf_to_bin(&conf, 0, -1);