X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXChannel.pm;h=b0208f103e0e6093df5b654c133420e110780419;hb=b359511572b5dcd67dc17437e7ce4ca3574eada8;hp=6da3ecbe36d0be30a00ee2a47ce64bdac9f1e411;hpb=dc305f992d75a6b35edda9e1aefab510a3ed617e;p=spider.git diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 6da3ecbe..b0208f10 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -178,6 +178,14 @@ sub alloc return $channels{$call} = $self; } +# rebless this channel as something else +sub rebless +{ + my $self = shift; + my $class = shift; + return $channels{$self->{call}} = bless $self, $class; +} + sub rec { my ($self, $msg) = @_; @@ -388,15 +396,16 @@ sub send # this is always later and always data return unless $conn; my $call = $self->{call}; - for (@_) { -# chomp; - my @lines = split /\n/; - for (@lines) { - $conn->send_later("D$call|$_"); - dbg("-> D $call $_") if isdbg('chan'); + foreach my $l (@_) { + for (ref $l ? @$l : $l) { + my @lines = split /\n/; + for (@lines) { + $conn->send_later("D$call|$_"); + dbg("-> D $call $_") if isdbg('chan'); + } } } - $self->{t} = time; + $self->{t} = $main::systime; } # send a file (always later)