Delay setting the /cset CHANMODE mode on new channels until the channel is synched.
Instead of setting the mode at NAMES time (when we know that the channel is new), remember this for later by setting the GOTNEW flag in the joinlist entry. Then check this flag when the channel is synched. Setting the channel mode takes us out of server "grace mode", which slows down the processing of subsequent commands and drastically reduces the number of commands we can have outstanding before we get kicked off for flooding. This change allows us to stay in grace mode while we're synching every channel that we joined at connect. In turn, this makes joining lots of channels on connect faster, and much less likely to cause us to be booted with "Excess Flood". git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@515 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
[Changes 1.2c01]
|
||||
|
||||
* Don't set the mode on new channels until synched - this speeds up joining
|
||||
lots of channels at connect time if one of them is new, and reduces the
|
||||
chance of being flooded off the server. (caf)
|
||||
|
||||
* Correctly handle channel sync across multi-server. (caf)
|
||||
|
||||
* Fixes and improvements for channel logging. (caf)
|
||||
|
||||
@@ -20,11 +20,13 @@
|
||||
#define CHAN_NOUNLINK 1
|
||||
#define CHAN_UNLINK 2
|
||||
|
||||
/* for got_mode */
|
||||
#define GOTNAMES 0x01
|
||||
#define GOTMODE 0x02
|
||||
#define GOTBANS 0x04
|
||||
#define GOTWHO 0x08
|
||||
#define GOTEXEMPT 0x10
|
||||
#define GOTNEW 0x20 /* Indicates newly-created channel */
|
||||
|
||||
/* Channel mode flags */
|
||||
#define MODE_ANONYMOUS (1U << 0) /* av2.9 */
|
||||
|
||||
@@ -320,12 +320,8 @@ int user_count = 0;
|
||||
print_funny_names(line);
|
||||
}
|
||||
if ((user_count == 1) && (*line == '@'))
|
||||
{
|
||||
ChannelList *chan;
|
||||
if ((chan = lookup_channel(channel, from_server, CHAN_NOUNLINK)))
|
||||
if ((ptr = get_cset_str_var(chan->csets, CHANMODE_CSET)))
|
||||
my_send_to_server(from_server, "MODE %s %s", channel, ptr);
|
||||
}
|
||||
got_info(channel, from_server, GOTNAMES | GOTNEW);
|
||||
else
|
||||
got_info(channel, from_server, GOTNAMES);
|
||||
reset_display_target();
|
||||
return;
|
||||
|
||||
@@ -1845,21 +1845,33 @@ int in_join_list(char *chan, int server)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void channel_sync(struct joinlist *tmp, char *chan)
|
||||
void channel_sync(struct joinlist *tmp, char *channel)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
if (tmp->gotinfo & GOTNEW)
|
||||
{
|
||||
/* A channel that we just created. */
|
||||
ChannelList *chan;
|
||||
char *chanmode;
|
||||
|
||||
if ((chan = lookup_channel(channel, tmp->server, CHAN_NOUNLINK)))
|
||||
if ((chanmode = get_cset_str_var(chan->csets, CHANMODE_CSET)))
|
||||
my_send_to_server(tmp->server, "MODE %s :%s", channel, chanmode);
|
||||
}
|
||||
|
||||
get_time(&tv);
|
||||
set_display_target(chan, LOG_CRAP);
|
||||
if (do_hook(CHANNEL_SYNCH_LIST, "%s %1.3f", chan, BX_time_diff(tmp->tv,tv)))
|
||||
bitchsay("Join to %s was synched in %1.3f secs!!", chan, BX_time_diff(tmp->tv,tv));
|
||||
set_display_target(channel, LOG_CRAP);
|
||||
if (do_hook(CHANNEL_SYNCH_LIST, "%s %1.3f", channel, BX_time_diff(tmp->tv,tv)))
|
||||
bitchsay("Join to %s was synched in %1.3f secs!!", channel, BX_time_diff(tmp->tv,tv));
|
||||
#ifdef WANT_USERLIST
|
||||
delay_check_auto(chan);
|
||||
delay_check_auto(channel);
|
||||
#endif
|
||||
update_all_status(current_window, NULL, 0);
|
||||
reset_display_target();
|
||||
xterm_settitle();
|
||||
#ifdef GUI
|
||||
gui_update_nicklist(chan);
|
||||
gui_update_nicklist(channel);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1872,14 +1884,15 @@ int got_info(char *chan, int server, int type)
|
||||
for (tmp = join_list; tmp; tmp = tmp->next)
|
||||
if (!my_stricmp(tmp->chan, chan) && tmp->server == server)
|
||||
{
|
||||
int what_info = (GOTNAMES | GOTMODE | GOTBANS | GOTWHO);
|
||||
int ver;
|
||||
int required = (GOTNAMES | GOTMODE | GOTBANS | GOTWHO);
|
||||
int ver = get_server_version(server);
|
||||
|
||||
ver = get_server_version(server);
|
||||
if ((ver == Server2_8ts4) || (ver == Server2_10))
|
||||
what_info |= GOTEXEMPT;
|
||||
required |= GOTEXEMPT;
|
||||
|
||||
if ((tmp->gotinfo |= type) == what_info)
|
||||
tmp->gotinfo |= type;
|
||||
|
||||
if ((tmp->gotinfo & required) == required)
|
||||
{
|
||||
channel_sync(tmp, chan);
|
||||
remove_from_join_list(chan, tmp->server);
|
||||
|
||||
Reference in New Issue
Block a user