Ignore:
Timestamp:
Dec 30, 2009, 2:12:15 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
Children:
901b931
Parents:
85fa6e4 (diff), d41f773 (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.
Message:
Merge branch 'release-1.5'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm

    r618a980 r416241f  
    2323
    2424use BarnOwl;
     25use Scalar::Util qw(weaken);
    2526
    2627BEGIN {
     
    315316    my $interval = shift || 5;
    316317    delete $BarnOwl::Module::IRC::ircnets{$self->alias};
    317     $BarnOwl::Module::IRC::reconnect{$self->alias} =
     318    $BarnOwl::Module::IRC::reconnect{$self->alias} = $self;
     319    my $weak = $self;
     320    weaken($weak);
     321    $self->{reconnect_timer} =
    318322        BarnOwl::Timer->new( {
    319323            after => $interval,
    320324            cb    => sub {
    321                 $self->reconnect( $interval );
     325                $weak->reconnect( $interval ) if $weak;
    322326            },
    323327        } );
    324     $BarnOwl::Module::IRC::reconnect{$self->alias}{conn} = $self;
     328}
     329
     330sub cancel_reconnect {
     331    my $self = shift;
     332    delete $BarnOwl::Module::IRC::reconnect{$self->alias};
     333    delete $self->{reconnect_timer};
    325334}
    326335
     
    329338    my $msg = shift;
    330339    BarnOwl::admin_message("IRC", $msg);
    331     delete $BarnOwl::Module::IRC::reconnect{$self->alias};
     340    $self->cancel_reconnect;
    332341    $BarnOwl::Module::IRC::ircnets{$self->alias} = $self;
    333342    my $fd = $self->getSocket()->fileno();
Note: See TracChangeset for help on using the changeset viewer.