Changeset 3acab0e


Ignore:
Timestamp:
Dec 28, 2009, 12:25:00 AM (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:
416241f
Parents:
54b4a87
git-author:
Nelson Elhage <nelhage@mit.edu> (12/22/09 17:53:48)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/28/09 00:25:00)
Message:
IRC: Store connection objects in %reconnect, rather than timers.
File:
1 edited

Legend:

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

    rac374fc r3acab0e  
    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        } );
     
    329333    BarnOwl::admin_message("IRC", $msg);
    330334    delete $BarnOwl::Module::IRC::reconnect{$self->alias};
     335    delete $self->{reconnect_timer};
    331336    $BarnOwl::Module::IRC::ircnets{$self->alias} = $self;
    332337    my $fd = $self->getSocket()->fileno();
Note: See TracChangeset for help on using the changeset viewer.