--- googlecode.com/svn/trunk/Meteor/Subscriber.pm 2007/05/20 14:19:00 24 +++ googlecode.com/svn/trunk/Meteor/Subscriber.pm 2007/05/20 19:40:53 25 @@ -43,6 +43,7 @@ @Meteor::Subscriber::ISA=qw(Meteor::Connection); our %PersistentConnections=(); + our $NumAcceptedConnections=0; ############################################################################### # Factory methods @@ -63,6 +64,9 @@ $self->{'ConnectionTimeLimit'}=$self->{'ConnectionStart'}+$maxTime; } + $::Statistics->{'current_subscribers'}++; + $::Statistics->{'subscriber_connections_accepted'}++; + $self; } @@ -97,6 +101,11 @@ map { $_->checkForMaxTime($time) } @cons; } +sub numSubscribers { + + return scalar(keys %PersistentConnections); +} + ############################################################################### # Instance methods ############################################################################### @@ -271,6 +280,7 @@ my $self=shift; $self->emitHeader('404 Not Found'); + $::Statistics->{'errors_served'}++; # close up shop here! $self->close(); @@ -318,9 +328,14 @@ sub sendMessage { my $self=shift; my $msg=shift; + my $numMsgInThisBatch=shift; + + $numMsgInThisBatch=1 unless(defined($numMsgInThisBatch)); $self->write($msg); + $::Statistics->{'messages_served'}+=$numMsgInThisBatch; + my $msgCount=++$self->{'MessageCount'}; my $maxMsg=$::CONF{'MaxMessages'}; @@ -378,6 +393,8 @@ } } + $::Statistics->{'current_subscribers'}--; + $self->SUPER::close(); }