diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bahamut.c | 8 | ||||
-rw-r--r-- | src/hybrid.c | 8 | ||||
-rw-r--r-- | src/plexus.c | 8 | ||||
-rw-r--r-- | src/rageircd.c | 8 | ||||
-rw-r--r-- | src/servers.c | 50 | ||||
-rw-r--r-- | src/shadowircd.c | 8 | ||||
-rw-r--r-- | src/solidircd.c | 8 | ||||
-rw-r--r-- | src/ultimate3.c | 8 | ||||
-rw-r--r-- | src/unreal32.c | 8 | ||||
-rw-r--r-- | src/viagra.c | 8 |
10 files changed, 77 insertions, 45 deletions
diff --git a/src/bahamut.c b/src/bahamut.c index dca254bff..1f54406bc 100644 --- a/src/bahamut.c +++ b/src/bahamut.c @@ -1619,11 +1619,9 @@ int anope_event_burst(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); } return MOD_CONT; } diff --git a/src/hybrid.c b/src/hybrid.c index fb9a87254..b966fa5a7 100644 --- a/src/hybrid.c +++ b/src/hybrid.c @@ -933,11 +933,9 @@ int anope_event_eob(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); return MOD_CONT; } diff --git a/src/plexus.c b/src/plexus.c index 7b5c54f2f..63ef88996 100644 --- a/src/plexus.c +++ b/src/plexus.c @@ -1015,11 +1015,9 @@ int anope_event_eob(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); return MOD_CONT; } diff --git a/src/rageircd.c b/src/rageircd.c index b638d210c..b357a408c 100644 --- a/src/rageircd.c +++ b/src/rageircd.c @@ -593,11 +593,9 @@ int anope_event_burst(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); } return MOD_CONT; } diff --git a/src/servers.c b/src/servers.c index eb91f1226..9fb63c734 100644 --- a/src/servers.c +++ b/src/servers.c @@ -550,4 +550,54 @@ int is_sync(Server * server) return 0; } +/*************************************************************************/ + +/* Finish the syncing process for this server and (optionally) for all + * it's leaves as well + * @param serv Server to finish syncing + * @param sync_links Should all leaves be synced as well? (1: yes, 0: no) + * @return void + */ +void finish_sync(Server * serv, int sync_links) +{ + Server *s; + + if (!serv || is_sync(serv)) + return; + + /* Mark each server as in sync */ + s = serv; + do { + if (!is_sync(s)) { + if (debug) + alog("Finishing sync for server %s", s->name); + + s->sync = SSYNC_DONE; + } + + if (!sync_links) + break; + + if (s->links) { + s = s->links; + } else if (s->next) { + s = s->next; + } else { + do { + s = s->uplink; + if (s == serv) + s = NULL; + if (s == me_server) + s = NULL; + } while (s && !(s->next)); + if (s) + s = s->next; + } + } while (s); + + /* Do some general stuff which should only be done once */ + restore_unsynced_topics(); + alog("Server %s is done syncing", serv->name); +} + /* EOF */ diff --git a/src/shadowircd.c b/src/shadowircd.c index 0f7924a3f..2e4dcd239 100644 --- a/src/shadowircd.c +++ b/src/shadowircd.c @@ -1176,11 +1176,9 @@ int anope_event_eos(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); return MOD_CONT; } diff --git a/src/solidircd.c b/src/solidircd.c index 3c9567bc7..063b1d9c4 100644 --- a/src/solidircd.c +++ b/src/solidircd.c @@ -1653,11 +1653,9 @@ int anope_event_burst(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); } return MOD_CONT; } diff --git a/src/ultimate3.c b/src/ultimate3.c index 052c9812f..0489ef952 100644 --- a/src/ultimate3.c +++ b/src/ultimate3.c @@ -1746,11 +1746,9 @@ int anope_event_eob(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); } return MOD_CONT; } diff --git a/src/unreal32.c b/src/unreal32.c index a4b3cdf35..13b868f37 100644 --- a/src/unreal32.c +++ b/src/unreal32.c @@ -1574,11 +1574,9 @@ int anope_event_eos(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); return MOD_CONT; } diff --git a/src/viagra.c b/src/viagra.c index bc3878fd2..565508091 100644 --- a/src/viagra.c +++ b/src/viagra.c @@ -643,11 +643,9 @@ int anope_event_burst(char *source, int ac, char **av) * finished bursting. If there was no source, then our uplink * server finished bursting. -GD */ - if (s) - s->sync = SSYNC_DONE; - else if (serv_uplink) - serv_uplink->sync = SSYNC_DONE; - restore_unsynced_topics(); + if (!s && serv_uplink) + s = serv_uplink; + finish_sync(s, 1); } return MOD_CONT; } |