Changeset 658421f for perl/modules/IRC/lib/BarnOwl/Module
- Timestamp:
- Apr 13, 2017, 6:43:22 PM (7 years ago)
- Parents:
- 678a7650 (diff), 5405fb1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- tehmoth <james2vegas@aim.com> (04/13/17 18:43:22)
- git-committer:
- GitHub <noreply@github.com> (04/13/17 18:43:22)
- Location:
- perl/modules/IRC/lib/BarnOwl/Module
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r5405fb1 rd4f33f1 562 562 "[" . $conn->alias . "] Reconnect cancelled"); 563 563 $conn->cancel_reconnect; 564 delete $ircnets{$conn->alias}; 565 } elsif (exists $ircnets{$conn->alias}) { # inconsistent state; no socket, but not yet deleted 566 BarnOwl::admin_message('IRC', 567 "[" . $conn->alias . "] Attempt to disconnect from a socketless connection; deleting it"); 564 568 delete $ircnets{$conn->alias}; 565 569 } -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
rbe43554 r4379288 437 437 } 438 438 439 sub rejoin_channels { 440 my $self = shift; 441 my @channels = @_; 442 # As reported in https://barnowl.mit.edu/ticket/274, if we reconnect to 443 # too many at once, the server rejects us. Empirically, this is about 444 # 20-26, so we set the cap at 15, then delay further joins for 5 seconds. 445 my $MAX_RECONNECT_CHANNELS = 15; 446 my $DELAY = 5; 447 foreach my $c (@channels[ 0 .. $MAX_RECONNECT_CHANNELS ]) { 448 $self->conn->send_msg(join => $c); 449 } 450 if ($MAX_RECONNECT_CHANNELS < $#channels) { 451 my $remaining = $#channels - $MAX_RECONNECT_CHANNELS; 452 my $cur_alias = $self->alias; 453 BarnOwl::admin_message('IRC', "[$cur_alias] Delaying $remaining autorejoins for $DELAY seconds"); 454 # if we don't assign the timer to anything, then it gets garbage 455 # collected, and never runs 456 $self->{autoconnect_channels_delay_timer} = BarnOwl::Timer->new({ 457 name => "IRC rejoin overflow timer ($remaining remaining)", 458 after => $DELAY, 459 cb => sub { 460 rejoin_channels($self, @channels[ $MAX_RECONNECT_CHANNELS .. $#channels ]); 461 } 462 }); 463 } 464 } 465 466 439 467 sub connected { 440 468 my $self = shift; … … 443 471 $self->cancel_reconnect; 444 472 if ($self->autoconnect_channels) { 445 for my $c (@{$self->autoconnect_channels}) { 446 $self->conn->send_msg(join => $c); 447 } 473 rejoin_channels($self, @{$self->autoconnect_channels}); 448 474 } 449 475 $self->conn->enable_ping(60, sub {
Note: See TracChangeset
for help on using the changeset viewer.