/[meteor]/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 /trunk/Meteor/Subscriber.pm

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

googlecode.com/svn/trunk/Meteor/Subscriber.pm revision 62 by andrew.betts, Thu Nov 27 00:33:21 2008 UTC trunk/Meteor/Subscriber.pm revision 80 by dpavlin, Sun Mar 29 01:28:23 2009 UTC
# Line 39  package Meteor::Subscriber; Line 39  package Meteor::Subscriber;
39          use Meteor::Connection;          use Meteor::Connection;
40          use Meteor::Channel;          use Meteor::Channel;
41          use Meteor::Document;          use Meteor::Document;
42            use Meteor::Koha;
43                    
44          @Meteor::Subscriber::ISA=qw(Meteor::Connection);          @Meteor::Subscriber::ISA=qw(Meteor::Connection);
45                    
# Line 57  sub newFromServer { Line 58  sub newFromServer {
58          $self->{'headerBuffer'}='';          $self->{'headerBuffer'}='';
59          $self->{'messageCount'}=0;          $self->{'messageCount'}=0;
60                    
         my $maxTime=$::CONF{'MaxTime'};  
         if($maxTime>0)  
         {  
                 $self->{'connectionTimeLimit'}=$self->{'connectionStart'}+$maxTime;  
         }  
           
61          $::Statistics->{'current_subscribers'}++;          $::Statistics->{'current_subscribers'}++;
62          $::Statistics->{'subscriber_connections_accepted'}++;          $::Statistics->{'subscriber_connections_accepted'}++;
63                    
# Line 201  sub processLine { Line 196  sub processLine {
196                                          my $startIndex=$channels->{$channelName}->{'startIndex'};                                          my $startIndex=$channels->{$channelName}->{'startIndex'};
197                                          $self->{'channels'}->{$channelName}->addSubscriber($self,$startIndex,$persist,$self->{'mode'},$self->{'useragent'});                                          $self->{'channels'}->{$channelName}->addSubscriber($self,$startIndex,$persist,$self->{'mode'},$self->{'useragent'});
198                                  }                                  }
199                                  delete ($self->{'channels'}) unless($persist);                                  if (!$persist) {
200                                  $self->close(1, 'responseComplete') unless($persist);                                          delete ($self->{'channels'});
201                                  $self->close(1, 'closedOnEvent') unless($self->{'messageCount'} == 0);                                          $self->close(1, 'responseComplete');
202                                    }
203                                  delete($self->{'headerBuffer'});                                  delete($self->{'headerBuffer'});
204    
205                                    # If long polling, close connection immediately if any messages have been sent
206                                    if ($self->{'messageCount'} > 0 && $self->{'mode'} eq 'longpoll') {
207                                            $self->close(1, 'closedOnEvent');
208                                    }
209                                  return;                                  return;
210                          }                          }
211                  }                  }
# Line 215  sub processLine { Line 216  sub processLine {
216                          $self->close(1, 'disconnectRequested');                          $self->close(1, 'disconnectRequested');
217                          return;                          return;
218                  }                  }
219                    elsif($self->{'headerBuffer'}=~m{GET\s+/koha/(\S+)})
220                    {
221                            Meteor::Koha->item($self,$1);
222                            $self->SUPER::close();
223                            return;
224                    }
225                  elsif($self->{'headerBuffer'}=~/GET\s+([^\s\?]+)/)                  elsif($self->{'headerBuffer'}=~/GET\s+([^\s\?]+)/)
226                  {                  {
227                          Meteor::Document->serveFileToClient($1,$self);                          Meteor::Document->serveFileToClient($1,$self);
228                          $self->close(1, 'responseComplete');                          $self->SUPER::close();
229                          return;                          return;
230                  }                  }
231                                    
# Line 377  sub getConf { Line 384  sub getConf {
384          my $self=shift;          my $self=shift;
385          my $key=shift;          my $key=shift;
386                    
387          if(exists($self->{'mode'}) && $self->{'mode'} ne '')          if(exists($self->{'mode'}) && $self->{'mode'} ne '') {
388          {                  my $k=$key.$self->{'mode'};            
                 my $k=$key.$self->{'mode'};  
                   
389                  if(exists($::CONF{$k})) {                  if(exists($::CONF{$k})) {
390                          return $::CONF{$k};                          return $::CONF{$k};
391                  }                  }
# Line 390  sub getConf { Line 395  sub getConf {
395  }  }
396    
397  1;  1;
 ############################################################################EOF  
398    ############################################################################EOF

Legend:
Removed from v.62  
changed lines
  Added in v.80

  ViewVC Help
Powered by ViewVC 1.1.26