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 |
|
|
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 |
|
|
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 |
} |
} |
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 |
|
|
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 |
} |
} |
395 |
} |
} |
396 |
|
|
397 |
1; |
1; |
|
############################################################################EOF |
|
398 |
|
############################################################################EOF |