/[meteor]/googlecode.com/svn/trunk/Meteor/Subscriber.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /googlecode.com/svn/trunk/Meteor/Subscriber.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 24 by knops.gerd, Tue May 1 17:10:10 2007 UTC revision 25 by knops.gerd, Sun May 20 19:40:53 2007 UTC
# Line 43  package Meteor::Subscriber; Line 43  package Meteor::Subscriber;
43          @Meteor::Subscriber::ISA=qw(Meteor::Connection);          @Meteor::Subscriber::ISA=qw(Meteor::Connection);
44                    
45          our %PersistentConnections=();          our %PersistentConnections=();
46            our $NumAcceptedConnections=0;
47    
48  ###############################################################################  ###############################################################################
49  # Factory methods  # Factory methods
# Line 63  sub newFromServer { Line 64  sub newFromServer {
64                  $self->{'ConnectionTimeLimit'}=$self->{'ConnectionStart'}+$maxTime;                  $self->{'ConnectionTimeLimit'}=$self->{'ConnectionStart'}+$maxTime;
65          }          }
66                    
67            $::Statistics->{'current_subscribers'}++;
68            $::Statistics->{'subscriber_connections_accepted'}++;
69            
70          $self;          $self;
71  }  }
72    
# Line 97  sub checkPersistentConnectionsForMaxTime Line 101  sub checkPersistentConnectionsForMaxTime
101          map { $_->checkForMaxTime($time) } @cons;          map { $_->checkForMaxTime($time) } @cons;
102  }  }
103    
104    sub numSubscribers {
105            
106            return scalar(keys %PersistentConnections);
107    }
108    
109  ###############################################################################  ###############################################################################
110  # Instance methods  # Instance methods
111  ###############################################################################  ###############################################################################
# Line 271  sub emitErrorHeader { Line 280  sub emitErrorHeader {
280          my $self=shift;          my $self=shift;
281                    
282          $self->emitHeader('404 Not Found');          $self->emitHeader('404 Not Found');
283            $::Statistics->{'errors_served'}++;
284                    
285          # close up shop here!          # close up shop here!
286          $self->close();          $self->close();
# Line 318  sub emitHeader { Line 328  sub emitHeader {
328  sub sendMessage {  sub sendMessage {
329          my $self=shift;          my $self=shift;
330          my $msg=shift;          my $msg=shift;
331            my $numMsgInThisBatch=shift;
332            
333            $numMsgInThisBatch=1 unless(defined($numMsgInThisBatch));
334                    
335          $self->write($msg);          $self->write($msg);
336                    
337            $::Statistics->{'messages_served'}+=$numMsgInThisBatch;
338            
339          my $msgCount=++$self->{'MessageCount'};          my $msgCount=++$self->{'MessageCount'};
340                    
341          my $maxMsg=$::CONF{'MaxMessages'};          my $maxMsg=$::CONF{'MaxMessages'};
# Line 378  sub close { Line 393  sub close {
393                  }                  }
394          }          }
395                    
396            $::Statistics->{'current_subscribers'}--;
397            
398          $self->SUPER::close();          $self->SUPER::close();
399  }  }
400    

Legend:
Removed from v.24  
changed lines
  Added in v.25

  ViewVC Help
Powered by ViewVC 1.1.26