From: Alex Badea Date: Fri, 12 Apr 2002 13:50:27 +0000 (+0000) Subject: Author: Alex Badea X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=1b7928d251ad4ec2a5692dcdc233b8363823bd13 Author: Alex Badea Log message: Added documentation and minor fixes to the lazy-leaf patch. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@732 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/patches/diffs/lazy.diff b/patches/diffs/lazy.diff index 4cd8e3a..4ca15a1 100644 --- a/patches/diffs/lazy.diff +++ b/patches/diffs/lazy.diff @@ -1,15 +1,15 @@ Index: include/channel.h =================================================================== RCS file: /home/coder-com/cvs/ircu2.10/include/channel.h,v -retrieving revision 1.31 -diff -u -r1.31 channel.h ---- include/channel.h 2002/03/27 22:30:24 1.31 -+++ include/channel.h 2002/04/02 07:11:52 +retrieving revision 1.32 +diff -u -r1.32 channel.h +--- include/channel.h 2002/04/03 21:16:01 1.32 ++++ include/channel.h 2002/04/12 13:47:52 @@ -95,6 +95,8 @@ #define MODE_BURSTADDED 0x80000 /* channel was created by a BURST */ #define MODE_UPASS 0x100000 #define MODE_APASS 0x200000 -+#define MODE_EMPTY 0x400000 /* LazeLeaf: no more locals, remove channel asap */ ++#define MODE_EMPTY 0x400000 /* LazyLeaf: no more locals, remove channel asap */ + /* * mode flags which take another parameter (With PARAmeterS) @@ -47,10 +47,10 @@ diff -u -r1.31 channel.h Index: include/client.h =================================================================== RCS file: /home/coder-com/cvs/ircu2.10/include/client.h,v -retrieving revision 1.25 -diff -u -r1.25 client.h ---- include/client.h 2002/03/19 10:54:28 1.25 -+++ include/client.h 2002/04/02 07:11:53 +retrieving revision 1.26 +diff -u -r1.26 client.h +--- include/client.h 2002/04/05 11:36:58 1.26 ++++ include/client.h 2002/04/12 13:47:52 @@ -369,6 +369,7 @@ #define FLAGS_DOID 0x00040000 /* I-lines say must use ident return */ #define FLAGS_NONL 0x00080000 /* No \n in buffer */ @@ -89,7 +89,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/include/handlers.h,v retrieving revision 1.16 diff -u -r1.16 handlers.h --- include/handlers.h 2002/03/19 22:03:36 1.16 -+++ include/handlers.h 2002/04/02 07:11:53 ++++ include/handlers.h 2002/04/12 13:47:52 @@ -183,6 +183,7 @@ extern int ms_gline(struct Client*, struct Client*, int, char*[]); extern int ms_info(struct Client*, struct Client*, int, char*[]); @@ -101,10 +101,10 @@ diff -u -r1.16 handlers.h Index: include/ircd_features.h =================================================================== RCS file: /home/coder-com/cvs/ircu2.10/include/ircd_features.h,v -retrieving revision 1.14 -diff -u -r1.14 ircd_features.h ---- include/ircd_features.h 2002/03/20 06:33:24 1.14 -+++ include/ircd_features.h 2002/04/02 07:11:53 +retrieving revision 1.15 +diff -u -r1.15 ircd_features.h +--- include/ircd_features.h 2002/04/03 15:23:47 1.15 ++++ include/ircd_features.h 2002/04/12 13:47:52 @@ -37,6 +37,7 @@ FEAT_KILL_IPMISMATCH, FEAT_IDLE_FROM_MSG, @@ -119,7 +119,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/include/msg.h,v retrieving revision 1.12 diff -u -r1.12 msg.h --- include/msg.h 2002/02/14 00:20:40 1.12 -+++ include/msg.h 2002/04/02 07:11:53 ++++ include/msg.h 2002/04/12 13:47:52 @@ -330,6 +330,10 @@ #define TOK_ACCOUNT "AC" #define CMD_ACCOUNT MSG_ACCOUNT, TOK_ACCOUNT @@ -137,7 +137,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/include/s_serv.h,v retrieving revision 1.6 diff -u -r1.6 s_serv.h --- include/s_serv.h 2001/06/08 23:12:16 1.6 -+++ include/s_serv.h 2002/04/02 07:11:53 ++++ include/s_serv.h 2002/04/12 13:47:52 @@ -12,9 +12,11 @@ struct ConfItem; @@ -165,7 +165,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/include/send.h,v retrieving revision 1.17 diff -u -r1.17 send.h --- include/send.h 2002/02/14 00:20:41 1.17 -+++ include/send.h 2002/04/02 07:11:53 ++++ include/send.h 2002/04/12 13:47:52 @@ -47,6 +47,12 @@ const char *tok, struct Client *one, const char *pattern, ...); @@ -185,7 +185,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/include/struct.h,v retrieving revision 1.3 diff -u -r1.3 struct.h --- include/struct.h 2002/02/14 00:20:41 1.3 -+++ include/struct.h 2002/04/02 07:11:53 ++++ include/struct.h 2002/04/12 13:47:52 @@ -52,6 +52,7 @@ unsigned short nn_last; /* Last numeric nick for p9 servers only */ unsigned int nn_mask; /* [Remote] FD_SETSIZE - 1 */ @@ -194,13 +194,28 @@ diff -u -r1.3 struct.h char *last_error_msg; /* Allocated memory with last message receive with an ERROR */ char by[NICKLEN + 1]; +Index: ircd/Makefile.in +=================================================================== +RCS file: /home/coder-com/cvs/ircu2.10/ircd/Makefile.in,v +retrieving revision 1.43 +diff -u -r1.43 Makefile.in +--- ircd/Makefile.in 2002/04/03 21:16:01 1.43 ++++ ircd/Makefile.in 2002/04/12 13:47:52 +@@ -120,6 +120,7 @@ + m_die.c \ + m_endburst.c \ + m_error.c \ ++ m_forget.c \ + m_get.c \ + m_gline.c \ + m_help.c \ Index: ircd/channel.c =================================================================== RCS file: /home/coder-com/cvs/ircu2.10/ircd/channel.c,v -retrieving revision 1.79 -diff -u -r1.79 channel.c ---- ircd/channel.c 2002/04/02 00:26:46 1.79 -+++ ircd/channel.c 2002/04/02 07:11:54 +retrieving revision 1.81 +diff -u -r1.81 channel.c +--- ircd/channel.c 2002/04/03 21:16:01 1.81 ++++ ircd/channel.c 2002/04/12 13:47:52 @@ -46,6 +46,7 @@ #include "s_conf.h" #include "s_debug.h" @@ -227,20 +242,25 @@ diff -u -r1.79 channel.c member->next_member = membershipFreeList; membershipFreeList = member; -@@ -587,6 +592,12 @@ +@@ -587,6 +592,17 @@ struct Membership* member; assert(0 != chptr); + if (chptr->mode.mode & MODE_EMPTY) { -+ while (remove_member_from_channel(chptr->members)) -+ ; ++ assert(feature_bool(FEAT_LAZY_LEAF)); ++ ++ /* Channel has no more locals, free it */ ++ do { ++ assert(!MyUser(chptr->members->user)); ++ } while (remove_member_from_channel(chptr->members)); ++ + return; + } + if ((member = find_member_link(chptr, cptr))) { if (remove_member_from_channel(member)) { if (channel_all_zombies(chptr)) { -@@ -1417,6 +1428,7 @@ +@@ -1417,6 +1433,7 @@ for (; acptr != &me; acptr = (cli_serv(acptr))->up) if (acptr == (cli_user(who))->server) /* Case d) (server 5) */ { @@ -248,7 +268,7 @@ diff -u -r1.79 channel.c remove_user_from_channel(who, chptr); return; } -@@ -1769,8 +1781,8 @@ +@@ -1769,8 +1786,8 @@ if (mbuf->mb_dest & MODEBUF_DEST_OPMODE) { /* If OPMODE was set, we're propagating the mode as an OPMODE message */ @@ -259,7 +279,7 @@ diff -u -r1.79 channel.c rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", addbuf, remstr, addstr); } else if (mbuf->mb_dest & MODEBUF_DEST_BOUNCE) { -@@ -1789,14 +1801,16 @@ +@@ -1789,14 +1806,16 @@ * we send the actual channel TS unless this is a HACK3 or a HACK4 */ if (IsServer(mbuf->mb_source)) @@ -278,7 +298,7 @@ diff -u -r1.79 channel.c "%H %s%s%s%s%s%s", mbuf->mb_channel, rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", addbuf, remstr, addstr); -@@ -3143,7 +3157,7 @@ +@@ -3143,7 +3162,7 @@ /* send notification to all servers */ if (jbuf->jb_type != JOINBUF_TYPE_CREATE && !IsLocalChannel(chan->chname)) @@ -287,7 +307,7 @@ diff -u -r1.79 channel.c "%H %Tu", chan, chan->creationtime); /* Send the notification to the channel */ -@@ -3191,9 +3205,37 @@ +@@ -3192,9 +3211,37 @@ build_string(chanlist, &chanlist_i, jbuf->jb_channels[i] ? jbuf->jb_channels[i]->chname : "0", 0, i == 0 ? '\0' : ','); @@ -326,7 +346,7 @@ diff -u -r1.79 channel.c jbuf->jb_channels[i] = 0; /* mark slot empty */ } -@@ -3203,6 +3245,7 @@ +@@ -3204,6 +3251,7 @@ STARTJOINLEN : STARTCREATELEN) + (jbuf->jb_comment ? strlen(jbuf->jb_comment) + 2 : 0)); @@ -334,7 +354,7 @@ diff -u -r1.79 channel.c /* and send the appropriate command */ switch (jbuf->jb_type) { case JOINBUF_TYPE_CREATE: -@@ -3216,6 +3259,7 @@ +@@ -3217,6 +3265,7 @@ jbuf->jb_comment); break; } @@ -345,10 +365,10 @@ diff -u -r1.79 channel.c Index: ircd/ircd_features.c =================================================================== RCS file: /home/coder-com/cvs/ircu2.10/ircd/ircd_features.c,v -retrieving revision 1.18 -diff -u -r1.18 ircd_features.c ---- ircd/ircd_features.c 2002/03/20 06:33:25 1.18 -+++ ircd/ircd_features.c 2002/04/02 07:11:55 +retrieving revision 1.19 +diff -u -r1.19 ircd_features.c +--- ircd/ircd_features.c 2002/04/03 15:23:48 1.19 ++++ ircd/ircd_features.c 2002/04/12 13:47:52 @@ -244,6 +244,7 @@ F_B(KILL_IPMISMATCH, FEAT_OPER, 0, 0), F_B(IDLE_FROM_MSG, 0, 1, 0), @@ -363,7 +383,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_burst.c,v retrieving revision 1.16 diff -u -r1.16 m_burst.c --- ircd/m_burst.c 2002/03/27 22:30:24 1.16 -+++ ircd/m_burst.c 2002/04/02 07:11:55 ++++ ircd/m_burst.c 2002/04/12 13:47:52 @@ -89,6 +89,7 @@ #include "ircd_policy.h" #include "ircd_reply.h" @@ -390,7 +410,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_clearmode.c,v retrieving revision 1.20 diff -u -r1.20 m_clearmode.c --- ircd/m_clearmode.c 2002/02/14 00:20:42 1.20 -+++ ircd/m_clearmode.c 2002/04/02 07:11:55 ++++ ircd/m_clearmode.c 2002/04/12 13:47:52 @@ -234,8 +234,8 @@ /* Then send it */ @@ -408,7 +428,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_create.c,v retrieving revision 1.12 diff -u -r1.12 m_create.c --- ircd/m_create.c 2002/02/14 00:20:42 1.12 -+++ ircd/m_create.c 2002/04/02 07:11:55 ++++ ircd/m_create.c 2002/04/12 13:47:52 @@ -154,6 +154,7 @@ continue; @@ -444,7 +464,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_join.c,v retrieving revision 1.19 diff -u -r1.19 m_join.c --- ircd/m_join.c 2002/03/13 09:19:21 1.19 -+++ ircd/m_join.c 2002/04/02 07:11:55 ++++ ircd/m_join.c 2002/04/12 13:47:52 @@ -373,6 +373,11 @@ chptr->creationtime = creation; } @@ -463,7 +483,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_kick.c,v retrieving revision 1.8 diff -u -r1.8 m_kick.c --- ircd/m_kick.c 2002/03/13 09:19:21 1.8 -+++ ircd/m_kick.c 2002/04/02 07:11:55 ++++ ircd/m_kick.c 2002/04/12 13:47:52 @@ -150,7 +150,7 @@ comment = EmptyString(parv[parc - 1]) ? parv[0] : parv[parc - 1]; @@ -488,7 +508,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_server.c,v retrieving revision 1.26 diff -u -r1.26 m_server.c --- ircd/m_server.c 2002/03/19 22:03:36 1.26 -+++ ircd/m_server.c 2002/04/02 07:11:56 ++++ ircd/m_server.c 2002/04/12 13:47:52 @@ -181,6 +181,9 @@ case 's': SetService(cptr); @@ -505,7 +525,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/m_topic.c,v retrieving revision 1.10 diff -u -r1.10 m_topic.c --- ircd/m_topic.c 2002/02/14 00:20:43 1.10 -+++ ircd/m_topic.c 2002/04/02 07:11:56 ++++ ircd/m_topic.c 2002/04/12 13:47:52 @@ -115,8 +115,8 @@ chptr->topic_time = CurrentTime; /* Fixed in 2.10.11: Don't propergate local topics */ @@ -523,7 +543,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/parse.c,v retrieving revision 1.34 diff -u -r1.34 parse.c --- ircd/parse.c 2002/03/19 22:03:36 1.34 -+++ ircd/parse.c 2002/04/02 07:11:57 ++++ ircd/parse.c 2002/04/12 13:47:53 @@ -577,6 +577,13 @@ /* UNREG, CLIENT, SERVER, OPER, SERVICE */ { m_ignore, m_ignore, ms_account, m_ignore, m_ignore } @@ -541,10 +561,10 @@ diff -u -r1.34 parse.c Index: ircd/s_bsd.c =================================================================== RCS file: /home/coder-com/cvs/ircu2.10/ircd/s_bsd.c,v -retrieving revision 1.47 -diff -u -r1.47 s_bsd.c ---- ircd/s_bsd.c 2002/04/02 00:26:46 1.47 -+++ ircd/s_bsd.c 2002/04/02 07:11:58 +retrieving revision 1.48 +diff -u -r1.48 s_bsd.c +--- ircd/s_bsd.c 2002/04/03 06:45:49 1.48 ++++ ircd/s_bsd.c 2002/04/12 13:47:53 @@ -465,7 +465,8 @@ sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s +%s :%s", cli_name(&me), cli_serv(&me)->timestamp, newts, @@ -561,7 +581,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/s_misc.c,v retrieving revision 1.31 diff -u -r1.31 s_misc.c --- ircd/s_misc.c 2002/04/02 00:26:47 1.31 -+++ ircd/s_misc.c 2002/04/02 07:11:59 ++++ ircd/s_misc.c 2002/04/12 13:47:53 @@ -48,6 +48,7 @@ #include "s_conf.h" #include "s_debug.h" @@ -585,7 +605,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/s_serv.c,v retrieving revision 1.28 diff -u -r1.28 s_serv.c --- ircd/s_serv.c 2002/02/14 00:20:44 1.28 -+++ ircd/s_serv.c 2002/04/02 07:11:59 ++++ ircd/s_serv.c 2002/04/12 13:47:53 @@ -36,6 +36,7 @@ #include "ircd_string.h" #include "ircd_snprintf.h" @@ -679,7 +699,7 @@ RCS file: /home/coder-com/cvs/ircu2.10/ircd/send.c,v retrieving revision 1.46 diff -u -r1.46 send.c --- ircd/send.c 2002/02/14 00:20:45 1.46 -+++ ircd/send.c 2002/04/02 07:11:59 ++++ ircd/send.c 2002/04/12 13:47:53 @@ -328,6 +328,35 @@ msgq_clean(mb); } @@ -716,8 +736,57 @@ diff -u -r1.46 send.c /* * Send a (prefix) command originating from to all channels * is locally on. must be a user. is ignored in ---- /dev/null Tue Mar 19 18:25:27 2002 -+++ ircd/m_forget.c Tue Apr 2 18:49:42 2002 +--- /dev/null Thu Aug 24 12:00:32 2000 ++++ doc/readme.lazylinks Fri Apr 12 16:47:36 2002 +@@ -0,0 +1,46 @@ ++Concept ++~~~~~~~ ++The idea behind lazy links is that leafs often don't need much of the ++state information they are sent. Currently, only lazy channels are ++implemented; this means lazy leafs will only be burst channels that ++they have local users on. ++ ++Protocol ++~~~~~~~~ ++If a leaf has FEAT_LAZY_LEAF set, it sends a +l flag in the SERVER message ++it sends to its hub (note that if FEAT_HUB is also set, it takes precedence ++over FEAT_LAZY_LEAF). The hub will then mark this leaf as 'lazy', and will ++not burst any channels to it. The hub will also keep a bitmask of which leaves ++know which channels. Subsequently, when the leaf tries to announce a channel ++to its hub (via a BURST, JOIN or CREATE) and the leaf doesn't "know" about ++that channel from the hub's point of view, the hub will send a full BURST of ++the channel back to the leaf, and mark the channel as "known" to the leaf. ++Note that a server with FEAT_LAZY_LEAF set *will* accept BURST messages outside ++of net.burst. When a channel has no more local clients, the leaf will send a ++FORGET message to the hub and destroy the channel locally. Upon receipt of this ++meessage, the hub will remove the "known" bit for that channel/leaf pair, and ++it will burst the channel again if the leaf tries to create it later on. The ++FORGET message has the following syntax: ++ FO <#channel> ++ ++Code ++~~~~ ++struct Server has a ll_mask field which is assigned to each lazy leaf on its ++uplink hub. Every leaf gets a bit, so the maximum number of leafs is 32 on ++32-bit machines. struct Channel now has a ll_bits bitmask field which stores ++which leaves "know" the channel. A new sendcmd_to_mask_butone function was ++used instead of sendcmdto_serv_butone which doesn't send to lazy leaves that ++don't match the specified mask (currently, chptr->ll_bits). ++ ++Bugs ++~~~~ ++This documentation is less than complete. ++ ++Commands like LIST, TOPIC, MODE issued on a lazy leaf for channels that hasn't ++been burst to it will incorrectly report the channels doesn't exist. This should ++be handled by forwarding those messages to its uplink. ++ ++joinbuf_flush now sends each join/part as a separate message, because they each ++have to be matched against the leaves' "known channel" bits. ++ ++Probably more. +--- /dev/null Thu Aug 24 12:00:32 2000 ++++ ircd/m_forget.c Wed Apr 3 23:07:14 2002 @@ -0,0 +1,123 @@ +/* + * IRC - Internet Relay Chat, ircd/m_forget.c @@ -740,7 +809,7 @@ diff -u -r1.46 send.c + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * -+ * $Id: lazy.diff,v 1.1 2002-04-02 07:17:11 isomer Exp $ ++ * $Id: lazy.diff,v 1.2 2002-04-12 13:50:27 vampire Exp $ + */ + +/* @@ -830,11 +899,11 @@ diff -u -r1.46 send.c + if (parc < 2) + return need_more_params(sptr, "FORGET"); + -+ if (!IsLazy(cptr)) -+ return 0; -+ -+ /* Don't pass on forget messages for channels that exist */ -+ if (!(chptr = FindChannel(parv[1]))) ++ /* ++ * Only lazy leafs may forget about channels. ++ * Ignore forget messages for channels that don't exist. ++ */ ++ if (!IsLazy(cptr) || !(chptr = FindChannel(parv[1]))) + return 0; + + chptr->ll_bits &= ~cli_serv(cptr)->ll_mask;