X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?p=spider.git;a=blobdiff_plain;f=perl%2FDXChannel.pm;h=9ba985a6773b0b1425a8d4bbf27b7ddd0fc33b45;hp=065a78c8d7af7e06293117a99332935634cfbab2;hb=625ce0adf070a7e900fa03714a391652db0c065a;hpb=56b610b0ed32b6d10122bca7554ce7a11251cdaa diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 065a78c8..9ba985a6 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -46,6 +46,7 @@ sub new $self->{user} = $user if defined $user; $self->{t} = time; $self->{state} = 0; + $self->{oldstate} = 0; bless $self, $pkg; return $channels{$call} = $self; } @@ -106,8 +107,8 @@ sub send_now foreach $line (@_) { my $t = atime; chomp $line; - print main::DEBUG "$t > $sort $call $line\n" if defined DEBUG; - print "> $sort $call $line\n"; + print main::DEBUG "$t -> $sort $call $line\n" if defined DEBUG; + print "-> $sort $call $line\n"; $conn->send_now("$sort$call|$line"); } } @@ -135,8 +136,8 @@ sub send # this is always later and always data foreach $line (@_) { my $t = atime; chomp $line; - print main::DEBUG "$t > D $call $line\n" if defined DEBUG; - print "> D $call $line\n"; + print main::DEBUG "$t -> D $call $line\n" if defined DEBUG; + print "-> D $call $line\n"; $conn->send_later("D$call|$line"); } } @@ -163,5 +164,14 @@ sub msg $self->send(DXM::msg(@_)); } +# change the state of the channel - lots of scope for debugging here :-) +sub state +{ + my $self = shift; + $self->{oldstate} = $self->{state}; + $self->{state} = shift; + print "Db $self->{call} channel state $self->{oldstate} -> $self->{state}\n" if $main::debug; +} + 1; __END__;