44 |
|
|
45 |
our %PersistentConnections=(); |
our %PersistentConnections=(); |
46 |
our $NumAcceptedConnections=0; |
our $NumAcceptedConnections=0; |
47 |
|
|
48 |
|
|
49 |
############################################################################### |
############################################################################### |
50 |
# Factory methods |
# Factory methods |
90 |
my $msg=$::CONF{'PingMessage'}; |
my $msg=$::CONF{'PingMessage'}; |
91 |
my @cons=values %PersistentConnections; |
my @cons=values %PersistentConnections; |
92 |
|
|
93 |
map { $_->write($msg) } @cons; |
map { $_->write($msg.chr(0)) } @cons; |
94 |
} |
} |
95 |
|
|
96 |
sub checkPersistentConnectionsForMaxTime { |
sub checkPersistentConnectionsForMaxTime { |
153 |
my $channels={}; |
my $channels={}; |
154 |
my $channelName; |
my $channelName; |
155 |
my $offset; |
my $offset; |
156 |
foreach my $chandef (@channelData) |
foreach my $chandef (@channelData) { |
157 |
{ |
if($chandef=~/^([a-z0-9]+)(.(r|b|h)([0-9]*))?$/i) { |
|
if($chandef=~/^([a-z0-9]+)(.(r|b|h)([0-9]*))?$/) |
|
|
{ |
|
158 |
$channelName = $1; |
$channelName = $1; |
159 |
$channels->{$channelName}->{'startIndex'} = undef; |
$channels->{$channelName}->{'startIndex'} = undef; |
160 |
for ($3) { |
if ($3) { |
161 |
$offset = $4; |
$offset = $4; |
162 |
/r/ && do { $channels->{$channelName}->{'startIndex'} = $offset; last; }; |
if ($3 eq 'r') { $channels->{$channelName}->{'startIndex'} = $offset; } |
163 |
/b/ && do { $channels->{$channelName}->{'startIndex'} = -$offset; last; }; |
if ($3 eq 'b') { $channels->{$channelName}->{'startIndex'} = -$offset; } |
164 |
/h/ && do { $channels->{$channelName}->{'startIndex'} = 0; last; }; |
if ($3 eq 'h') { $channels->{$channelName}->{'startIndex'} = 0; } |
165 |
} |
} |
166 |
} |
} |
167 |
} |
} |
273 |
} |
} |
274 |
/gex; |
/gex; |
275 |
|
|
276 |
$self->write($header); |
$self->write($header.chr(0)); |
277 |
} |
} |
278 |
|
|
279 |
sub sendMessage { |
sub sendMessage { |
283 |
|
|
284 |
$numMsgInThisBatch=1 unless(defined($numMsgInThisBatch)); |
$numMsgInThisBatch=1 unless(defined($numMsgInThisBatch)); |
285 |
|
|
286 |
$self->write($msg); |
$self->write($msg.chr(0)); |
287 |
|
|
288 |
$::Statistics->{'messages_served'}+=$numMsgInThisBatch; |
$::Statistics->{'messages_served'}+=$numMsgInThisBatch; |
289 |
|
|
344 |
} |
} |
345 |
} |
} |
346 |
|
|
|
$::Statistics->{'current_subscribers'}--; |
|
|
|
|
347 |
$self->SUPER::close(); |
$self->SUPER::close(); |
348 |
} |
} |
349 |
|
|
350 |
|
sub didClose { |
351 |
|
|
352 |
|
$::Statistics->{'current_subscribers'}--; |
353 |
|
} |
354 |
|
|
355 |
sub checkForMaxTime { |
sub checkForMaxTime { |
356 |
my $self=shift; |
my $self=shift; |
357 |
my $time=shift; |
my $time=shift; |