Changeset 3713b86


Ignore:
Timestamp:
Apr 3, 2011, 3:06:01 PM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
5d4262c
Parents:
59425a3
git-author:
Nelson Elhage <nelhage@mit.edu> (02/26/11 20:43:58)
git-committer:
Nelson Elhage <nelhage@mit.edu> (04/03/11 15:06:01)
Message:
IRC: Remove the %reconnect hash.

Keep everything in the %ircnets hash, always. This should hopefully help fix
some really confusing bugs where we get multiple connections that think they
have the same alias.
Location:
perl/modules/IRC/lib/BarnOwl/Module
Files:
2 edited

Legend:

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

    r851a0e0 r3713b86  
    3131our %ircnets;
    3232our %channels;
    33 our %reconnect;
    3433
    3534sub startup {
     
    398397    if ($conn->conn->{socket}) {
    399398        $conn->conn->disconnect("Goodbye!");
    400     } elsif ($reconnect{$conn->alias}) {
     399    } elsif ($conn->{reconnect_timer}) {
    401400        BarnOwl::admin_message('IRC',
    402401                               "[" . $conn->alias . "] Reconnect cancelled");
    403402        $conn->cancel_reconnect;
     403        delete $ircnets{$conn->alias};
    404404    }
    405405}
     
    620620    my $allow_disconnected = shift;
    621621
    622     return $ircnets{$key} if exists $ircnets{$key};
    623     return $reconnect{$key} if $allow_disconnected && exists $reconnect{$key};
    624     die("No such ircnet: $key\n")
     622    my $conn = $ircnets{$key};
     623    die("No such ircnet: $key\n") unless $conn;
     624    if ($conn->conn->{registered} || $allow_disconnected) {
     625        return $conn;
     626    }
     627    die("[@{[$conn->alias]}] Not currently connected.");
    625628}
    626629
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm

    r59425a3 r3713b86  
    379379    my $self = shift;
    380380    my $interval = shift || 5;
    381     $BarnOwl::Module::IRC::reconnect{$self->alias} = $self;
     381
    382382    my $weak = $self;
    383383    weaken($weak);
     
    397397sub cancel_reconnect {
    398398    my $self = shift;
    399     delete $BarnOwl::Module::IRC::reconnect{$self->alias};
     399
    400400    if (defined $self->{reconnect_timer}) {
    401401        $self->{reconnect_timer}->stop;
Note: See TracChangeset for help on using the changeset viewer.