DJabberd/Connection/Admin.pm

filter: Statementstmt 19.5% 52 / 266 Branchbran 4.8% 4 / 82 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 25.5% 11 / 43 Podpod 14.2% 4 / 28 totaltotal 15.5% 71 / 457 CC 60 SCAR 36.2
CC
60
Cov
15%
CMD_gladiator
156.0
arena_ref_counts
72.0
CMD_connections
56.0
CRAP 37.3
« DJabberd/Delivery/Local.pm ↑ Summary DJabberd/IQ.pm »
1 package DJabberd::Connection::Admin;
2 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 20 ▶use base 'Danga::Socket';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 20 ▶use fields qw(buffer server handle);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 20 ▶use vars qw($initial_memory @Help);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 20 ▶use Devel::Peek ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 0 ▶my $has_gladiator = eval "use Devel::Gladiator; 1;";
Subroutine BEGIN: called CC=1 SCAR=1.2
12 20 ▶my $has_cycle = eval "use Devel::Cycle; 1;";
Subroutine BEGIN: called CC=1 SCAR=0.0
13 0 ▶my $has_devel_leak = eval "use Devel::Leak; 1;";
Subroutine BEGIN: called CC=1 SCAR=1.2
14  
15 0 ▶sub on_startup {
Subroutine on_startup: not called CC=2 SCAR=17.9
Pod undocumented
16 0 ▶ $initial_memory ||= get_memory();
Condition0%0/3
$DJabberd::Connection::Admin::initial_memory ||= get_memory()
l!l&&r!l&&!r
000
MC/DC0%0/2
$DJabberd::Connection::Admin::initial_memory ||= get_memory()
$DJabberd::Connection::Admin::initial_memory get_memory()
Truth table0%0/3
A ||= B
A= $DJabberd::Connection::Admin::initial_memoryB= get_memory()
ABresult
1X1
011
000
17 }
18  
19 0 ▶sub get_memory {
Subroutine get_memory: not called CC=2 SCAR=17.9
Pod undocumented
20 0 my $mem;
21 0 ▶ if ($^O eq 'linux') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'linux') { } 0 0 0
22 0 my $pid = $$;
23 0 ($mem) = `cat /proc/$pid/status | grep ^VmRSS` =~ /(\d+)/;
24 } else {
25 0 $mem = 0;
26 }
27 0 return $mem;
28 }
29  
30 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
31 0 my ($class, $sock, $server) = @_;
32 0 my $self = $class->SUPER::new($sock);
33 0 $self->{server} = $server;
34 0 return $self;
35 }
36  
37 0 ▶sub event_read {
Subroutine event_read: not called CC=3 SCAR=24.8
Pod documented
38 0 my DJabberd::Connection::Admin $self = shift;
39  
40 0 my $bref = $self->read(20_000);
41 0 ▶ return $self->close unless defined $bref;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $bref 0 0 0
42  
43 0 $self->{buffer} .= $$bref;
44  
45 0 ▶ while ($self->{buffer} =~ s/^(.*?)\r?\n//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"buffer"} =~ s/^(.*?)\r?\n//) 0 0 0
46 0 my $line = $1;
47 0 $self->process_line($line);
48 }
49 }
50  
51 0 ▶sub process_line {
Subroutine process_line: not called CC=4 SCAR=30.0
Pod undocumented
52 0 my DJabberd::Connection::Admin $self = shift;
53 0 my $line = shift;
54 0 ▶ return unless $line =~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless $line =~ /\S/ 0 0 0
55  
56 0 $line =~ s/^\s*(\w+)\s*//;
57 0 my $command = $1;
58 0 ▶ unless ($command) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($command) 0 0 0
59 0 $self->write("Cannot parse command '$line'");
60 0 return;
61 }
62  
63 0 ▶ if (my $cref = DJabberd::Connection::Admin->can("CMD_" . $command)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $cref = 'DJabberd::Connection::Admin'->can('CMD_' . $command)) { } 0 0 0
64 0 $cref->($self, $line);
65 } else {
66 0 $self->write("Unknown command '$command'");
67 }
68 }
69  
70 20 push @Help, 'close | exit | quit';
71 0 ▶sub CMD_close { $_[0]->close }
Subroutine CMD_close: not called CC=1 SCAR=6.9
Pod undocumented
72 0 ▶sub CMD_quit { $_[0]->close }
Subroutine CMD_quit: not called CC=1 SCAR=6.9
Pod undocumented
73 0 ▶sub CMD_exit { $_[0]->close }
Subroutine CMD_exit: not called CC=1 SCAR=6.9
Pod undocumented
74  
75 20 push @Help, 'conns | connections';
76 20 *CMD_conns = \&CMD_connections;
77 0 ▶sub CMD_connections {
Subroutine CMD_connections: not called CC=7 SCAR=40.3
Pod undocumented
78 0 my ($self, $filter) = @_;
79  
80 0 my $map = Danga::Socket->DescriptorMap;
81 0 my @list;
82 0 foreach (keys %$map) {
83 0 my $obj = $map->{$_};
84 0 ▶ next if $filter eq "clients" && ref $obj ne "DJabberd::Connection::ClientIn";
Branch: 1 branch
BranchTrueFalseTotal
if $filter eq "clients" and ref $obj ne "DJabberd::Connection::ClientIn" 0 0 0
Condition0%0/3
$filter eq "clients" and ref $obj ne "DJabberd::Connection::ClientIn"
!ll&&!rl&&r
000
MC/DC0%0/2
$filter eq "clients" and ref $obj ne "DJabberd::Connection::ClientIn"
$filter eq "clients" ref $obj ne "DJabberd::Connection::ClientIn"
Truth table0%0/3
A and B
A= $filter eq "clients"B= ref $obj ne "DJabberd::Connection::ClientIn"
ABresult
0X0
100
111
85 0 ▶ next if $filter eq "servers" && ref $obj ne "DJabberd::Connection::ServerIn" &&
Branch: 1 branch
BranchTrueFalseTotal
if $filter eq "servers" and ref $obj ne "DJabberd::Connection::ServerIn" and ref $obj ne "DJabberd::Connection::ServerOut" 0 0 0
Condition0%0/6
$filter eq "servers" and ref $obj ne "DJabberd::Connection::ServerIn" and ref $obj ne "DJabberd::Connection::ServerOut"
!ll&&!rl&&r
000
$filter eq "servers" and ref $obj ne "DJabberd::Connection::ServerIn"
!ll&&!rl&&r
000
MC/DC0%0/3
$filter eq "servers" and ref $obj ne "DJabberd::Connection::ServerIn" and ref $obj ne "DJabberd::Connection::ServerOut"
$filter eq "servers" ref $obj ne "DJabberd::Connection::ServerIn" ref $obj ne "DJabberd::Connection::ServerOut"
Truth table0%0/4
A and B and C
A= $filter eq "servers"B= ref $obj ne "DJabberd::Connection::ServerIn"C= ref $obj ne "DJabberd::Connection::ServerOut"
ABCresult
0XX0
10X0
1100
1111
86 ref $obj ne "DJabberd::Connection::ServerOut";
87 0 push @list, $_;
88 }
89 0 my $conns = join(' ', @list);
90 0 $self->write($conns);
91 }
92  
93 20 push @Help, 'latency_log';
94 0 ▶sub CMD_latency_log {
Subroutine CMD_latency_log: not called CC=3 SCAR=24.8
Pod undocumented
95 0 my $self = shift;
96 0 foreach my $le (@DJabberd::Stats::stanza_process_latency_log) {
97 0 ▶ next unless defined $le;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $le 0 0 0
98 0 $self->write("$le->[0]\t$le->[1]");
99 }
100 0 $self->end;
101 }
102  
103 20 push @Help, 'latency';
104 0 ▶sub CMD_latency {
Subroutine CMD_latency: not called CC=7 SCAR=40.3
Pod undocumented
105 0 my $self = shift;
106 0 my %hist;
107 0 my @buckets = (
108 '0.0005',
109 '0.001', '0.002', '0.005',
110 '0.01', '0.02', '0.05',
111 '0.1', '0.2',
112 '1.0', '2.0', '10.0',
113 );
114 0 foreach my $td (@DJabberd::Stats::stanza_process_latency) {
115 0 ▶ next unless defined $td;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $td 0 0 0
116 0 foreach my $bk (@buckets) {
117 0 ▶ if ($td < $bk) {
Branch: 1 branch
BranchTrueFalseTotal
if ($td < $bk) 0 0 0
118 0 $hist{$bk}++;
119 0 last;
120 }
121 }
122 }
123 0 foreach my $bk (@buckets) {
124 0 ▶ next unless $hist{$bk};
Branch: 1 branch
BranchTrueFalseTotal
unless $hist{$bk} 0 0 0
125 0 $self->write("-$bk\t$hist{$bk}");
126 }
127 0 $self->end;
128 }
129  
130 20 push @Help, 'help';
131 0 ▶sub CMD_help {
Subroutine CMD_help: not called CC=2 SCAR=17.9
Pod undocumented
132 0 my $self = shift;
133 0 $self->write($_) for 'Available commands:', (sort @Help), '.';
134 }
135  
136 20 push @Help, 'list vhosts';
137 0 ▶sub CMD_list {
Subroutine CMD_list: not called CC=3 SCAR=24.8
Pod undocumented
138 0 my $self = shift;
139 0 my $type = shift;
140  
141 0 ▶ if ($type =~ /^vhosts?/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type =~ /^vhosts?/) { } 0 0 0
142 0 $self->write($_) foreach keys %{$self->{server}->{vhosts}};
143 0 $self->end;
144 } else {
145 0 $self->write("Cannot list '$type'");
146 }
147  
148 }
149  
150 20 push @Help, 'stats';
151 0 ▶sub CMD_stats {
Subroutine CMD_stats: not called CC=2 SCAR=17.9
Pod undocumented
152 0 my $self = shift;
153  
154 0 my $conns = keys %{ Danga::Socket->DescriptorMap};
155 0 my $conns_quick = $DJabberd::Stats::counter{connect} - $DJabberd::Stats::counter{disconnect};
156  
157 0 my $users = 0;
158 0 ▶ DJabberd->foreach_vhost(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
159 0 my $vhost = shift;
160 0 $users += keys %{$vhost->{jid2sock}};
161 0 });
162  
163 0 $self->write("connections\t$conns\tconnections");
164 0 $self->write("users\t$users\tusers");
165 0 $self->write("connections_quickcalc\t$conns_quick\tconnections");
166  
167 0 my $mem = get_memory();
168 0 my $user_mem = $mem - $initial_memory;
169  
170 0 $self->write("mem_total\t$mem\tkB");
171 0 $self->write("mem_connections\t$user_mem\tkB");
172 0 ▶ $self->write("mem_per_connection\t". ($user_mem / ($conns || 1) ) . "\tkB/conn");
Condition0%0/2
$conns || 1
l!l
00
MC/DC0%0/1
$conns || 1
$conns
Truth table0%0/2
A
A= $conns
Aresult
11
00
173 0 $self->end;
174 }
175  
176 20 push @Help, 'counters';
177 0 ▶sub CMD_counters {
Subroutine CMD_counters: not called CC=2 SCAR=17.9
Pod undocumented
178 0 my $self = shift;
179  
180 0 foreach my $name (sort keys %DJabberd::Stats::counter) {
181 0 $self->write("$name\t$DJabberd::Stats::counter{$name}");
182 }
183 0 $self->end;
184 }
185  
186 20 push @Help, 'users';
187 0 ▶sub CMD_users {
Subroutine CMD_users: not called CC=1 SCAR=6.9
Pod undocumented
188 0 my $self = shift;
189  
190 0 ▶ DJabberd->foreach_vhost(sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
191 0 my $vhost = shift;
192 0 $self->write("$vhost->{server_name}");
193 0 foreach my $jid (keys %{$vhost->{jid2sock}}) {
194 0 $self->write("\t$jid");
195 }
196 0 });
197 0 $self->end;
198 }
199  
200 20 push @Help, 'version';
201 0 ▶sub CMD_version {
Subroutine CMD_version: not called CC=1 SCAR=6.9
Pod undocumented
202 0 $_[0]->write($DJabberd::VERSION);
203 }
204  
205 0 ▶sub _in_sub_process {
Subroutine _in_sub_process: not called CC=3 SCAR=24.8
206 0 my $code = shift;
207 0 my $rand = rand();
208 0 my $file = ".tmp.$$.$rand.answer";
209  
210 0 my $cpid = fork;
211 0 ▶ if ($cpid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cpid) 0 0 0
212 0 wait;
213 0 open (my $fh, $file);
214 0 my $data = do { local $/; <$fh> };
215 0 my $res = eval { Storable::thaw($data); };
216 0 unlink $file;
217 0 return $res;
218 }
219  
220 0 my $res = $code->();
221 0 ▶ if (open (my $fh, ">$file.writing")) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $fh, ">$file.writing") 0 0 0
222 0 print $fh Storable::nfreeze($res);
223 0 CORE::close($fh);
224 0 rename "$file.writing", $file;
225 0 exit 0;
226 }
227 }
228  
229 0 ▶sub arena_ref_counts {
Subroutine arena_ref_counts: not called CC=8 SCAR=42.8
Pod undocumented
230 0 my $all = Devel::Gladiator::walk_arena();
231 0 my %ct;
232 0 foreach my $it (@$all) {
233 0 $ct{ref $it}++;
234 0 ▶ if (ref $it eq "REF") {
Branch: 5 branches
BranchTrueFalseTotal
if (ref $it eq 'REF') { } 0 0 0
elsif (ref $it eq 'DJabberd::IQ') { } 0 0 0
elsif (ref $it eq 'Gearman::Task') { } 0 0 0
elsif (ref $it eq 'DJabberd::Callback') { } 0 0 0
elsif (ref $it eq 'CODE') { } 0 0 0
235 0 $ct{"REF-" . ref $$it}++;
236 }
237 elsif (ref $it eq "DJabberd::IQ") {
238 0 $ct{"DJabberd::IQ-" . $it->signature}++;
239 }
240 elsif (ref $it eq "Gearman::Task") {
241 0 $ct{"Gearman::Task-func:$it->{func}"}++;
242 }
243 elsif (ref $it eq "DJabberd::Callback") {
244 0 ▶ $ct{"DJabberd::Callback-" . $it->{_phase}}++ if $it->{_phase};
Branch: 1 branch
BranchTrueFalseTotal
if $it->{"_phase"} 0 0 0
245 }
246 elsif (ref $it eq "CODE") {
247 0 $ct{Devel::Peek::CvGV($it)}++;
248 }
249 }
250 0 $all = undef;
251 0 return \%ct;
252 }
253  
254 20 ▶push @Help, 'gladiator [lite | delta | all] ' . ( $has_gladiator ? '' : '(unavailable)' );
Branch: 1 branch
BranchTrueFalseTotal
$has_gladiator ? : 0 20 20
255 20 my %last_gladiator;
256 0 ▶sub CMD_gladiator {
Subroutine CMD_gladiator: not called CC=12 SCAR=50.5
Pod undocumented
257 0 my ($self, $cmd) = @_;
258  
259 0 ▶ unless ($has_gladiator) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($has_gladiator) 0 0 0
260 0 $self->end;
261 0 return;
262 }
263  
264 0 ▶ $cmd ||= "lite";
Condition0%0/2
$cmd ||= "lite"
l!l
00
MC/DC0%0/1
$cmd ||= "lite"
$cmd
Truth table0%0/2
A
A= $cmd
Aresult
11
00
265  
266 0 ▶ my $ct = _in_sub_process(sub { arena_ref_counts() });
Subroutine __ANON__: not called CC=1 SCAR=6.9
267 0 my $ret;
268 0 $ret .= "ARENA COUNTS:\n";
269 0 foreach my $k (sort {$ct->{$b} <=> $ct->{$a}} keys %$ct) {
270 0 ▶ my $delta = $ct->{$k} - ($last_gladiator{$k} || 0);
Condition0%0/2
$last_gladiator{$k} || 0
l!l
00
MC/DC0%0/1
$last_gladiator{$k} || 0
$last_gladiator{$k}
Truth table0%0/2
A
A= $last_gladiator{$k}
Aresult
11
00
271 0 $last_gladiator{$k} = $ct->{$k};
272 0 ▶ if ($cmd eq "delta") {
Branch: 2 branches
BranchTrueFalseTotal
if ($cmd eq 'delta') { } 0 0 0
elsif ($cmd eq 'lite') { } 0 0 0
273 0 ▶ next unless $delta;
Branch: 1 branch
BranchTrueFalseTotal
unless $delta 0 0 0
274 } elsif ($cmd eq "lite") {
275 0 ▶ next if $k =~ /^REF-/;
Branch: 1 branch
BranchTrueFalseTotal
if $k =~ /^REF-/ 0 0 0
276 0 ▶ next if $k =~ /log4perl/i;
Branch: 1 branch
BranchTrueFalseTotal
if $k =~ /log4perl/i 0 0 0
277 } else {
278 0 ▶ next unless $ct->{$k} > 1 || $cmd eq "all";
Branch: 1 branch
BranchTrueFalseTotal
unless $ct->{$k} > 1 or $cmd eq "all" 0 0 0
Condition0%0/3
$ct->{$k} > 1 or $cmd eq "all"
l!l&&r!l&&!r
000
MC/DC0%0/2
$ct->{$k} > 1 or $cmd eq "all"
$ct->{$k} > 1 $cmd eq "all"
Truth table0%0/3
A or B
A= $ct->{$k} > 1B= $cmd eq "all"
ABresult
1X1
011
000
279 }
280 0 $ret .= sprintf(" %4d %-4d $k\n", $ct->{$k}, $delta);
281 }
282  
283 0 $self->write($ret);
284 0 $self->end;
285 }
286  
287 20 ▶push @Help, 'cycle ' . ( $has_gladiator ? '' : '(unavailable)' );
Branch: 1 branch
BranchTrueFalseTotal
$has_gladiator ? : 0 20 20
288 0 ▶sub CMD_cycle {
Subroutine CMD_cycle: not called CC=3 SCAR=21.1
Pod undocumented
289 0 my $self = shift;
290  
291 0 ▶ unless ($has_gladiator && $has_cycle) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($has_gladiator and $has_cycle) 0 0 0
Condition0%0/3
$has_gladiator and $has_cycle
!ll&&!rl&&r
000
MC/DC0%0/2
$has_gladiator and $has_cycle
$has_gladiator $has_cycle
Truth table0%0/3
A and B
A= $has_gladiatorB= $has_cycle
ABresult
0X0
100
111
292 0 $self->end;
293 0 return;
294 }
295  
296 0 my $array = Devel::Gladiator::walk_arena();
297 0 my @list = grep { ref($_) =~ /^DJabberd|Gearman|CODE/ } @$array;
298 0 $array = undef;
299  
300 20 ▶ use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
301 # my $flist = \%DJabberd::Connection::ClientIn::FIELDS;
302 # foreach my $k (sort { $flist->{$a} <=> $flist->{$b} } keys %$flist) {
303 # printf STDERR " %4d %s\n", $flist->{$k}, $k;
304 # }
305 0 find_cycle(\@list);
306 0 $self->end;
307  
308 }
309  
310 20 push @Help, 'fields package_name';
311 0 ▶sub CMD_fields {
Subroutine CMD_fields: not called CC=2 SCAR=17.9
Pod undocumented
312 0 my ($self, $arg) = @_;
313 0 my $flist = eval "\\%${arg}::FIELDS";
314 0 foreach my $k (sort { $flist->{$a} <=> $flist->{$b} } keys %$flist) {
315 0 printf STDERR " %4d %s\n", $flist->{$k}, $k;
316 }
317 0 $self->end;
318 }
319  
320 20 ▶push @Help, 'note_arena ' . ( $has_devel_leak ? '' : '(unavailable)' );
Branch: 1 branch
BranchTrueFalseTotal
$has_devel_leak ? : 0 20 20
321 0 ▶sub CMD_note_arena {
Subroutine CMD_note_arena: not called CC=2 SCAR=17.9
Pod undocumented
322 0 my ($self, $arg) = @_;
323 0 ▶ return unless $has_devel_leak;
Branch: 1 branch
BranchTrueFalseTotal
unless $has_devel_leak 0 0 0
324 0 $self->{handle} = 1;
325 0 Devel::Leak::NoteSV($self->{handle});
326 0 $self->end;
327 }
328  
329 20 ▶push @Help, 'check_arena ' . ( $has_devel_leak ? '' : '(unavailable)' );
Branch: 1 branch
BranchTrueFalseTotal
$has_devel_leak ? : 0 20 20
330 0 ▶sub CMD_check_arena {
Subroutine CMD_check_arena: not called CC=2 SCAR=17.9
Pod undocumented
331 0 my ($self, $arg) = @_;
332 0 ▶ return unless $has_devel_leak;
Branch: 1 branch
BranchTrueFalseTotal
unless $has_devel_leak 0 0 0
333 0 Devel::Leak::CheckSV($self->{handle});
334 0 $self->end;
335 }
336  
337 20 push @Help, 'reload';
338 0 ▶sub CMD_reload {
Subroutine CMD_reload: not called CC=2 SCAR=17.9
Pod undocumented
339 0 my $self = shift;
340 0 delete $INC{"DJabberd/Connection/Admin.pm"};
341 0 my $rv = eval "use DJabberd::Connection::Admin; 1;";
342 0 ▶ if ($rv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv) { } 0 0 0
343 0 $self->write("OK");
344 } else {
345 0 $self->write("ERROR: $@");
346 }
347 }
348  
349 20 push @Help, 'send_stanza JID STANZA';
350 0 ▶sub CMD_send_stanza {
Subroutine CMD_send_stanza: not called CC=5 SCAR=34.0
Pod undocumented
351 0 my ($self, $params) = @_;
352 0 my ($vname, $barejid_str, $e_stanza) = split(/\s+/, $params);
353  
354 0 my $vhost = DJabberd->lookup_vhost($vname);
355 0 ▶ unless ($vhost) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($vhost) 0 0 0
356 0 $self->write("ERROR bogus vhost");
357 0 return;
358 }
359  
360 0 my $jid = DJabberd::JID->new($barejid_str);
361 0 ▶ unless ($jid) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($jid) 0 0 0
362 0 $self->write("ERROR bogus jid");
363 0 return;
364 }
365  
366 0 my @dconns = $vhost->find_conns_of_bare($jid);
367 0 ▶ unless (@dconns) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@dconns) 0 0 0
368 0 $self->write("ERROR not connected");
369 0 return;
370 }
371  
372 0 foreach my $c (@dconns) {
373 0 $c->write(DJabberd::Util::durl($e_stanza));
374 }
375 0 $self->write("OK");
376 }
377  
378 0 ▶sub end {
Subroutine end: not called CC=1 SCAR=6.9
Pod undocumented
379 0 $_[0]->write('.');
380 }
381  
382 0 ▶sub write {
Subroutine write: not called CC=2 SCAR=17.9
Pod documented
383 0 my $self = shift;
384 0 my $string = shift;
385  
386 0 ▶ if (defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $string) { } 0 0 0
387 0 $self->SUPER::write($string . "\r\n");
388 } else {
389 # because event_write by default just kicks off more events, calling
390 # write with undef...
391 0 $self->SUPER::write(undef);
392 }
393 }
394  
395 0 ▶sub close {
Subroutine close: not called CC=2 SCAR=17.9
Pod documented
396 0 my $self = shift;
397 0 ▶ $DJabberd::Stats::counter{disconnect}++ unless $self->{closed};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"closed"} 0 0 0
398 0 $self->SUPER::close(@_);
399 }
400  
401 20 1;
« DJabberd/Delivery/Local.pm ↑ Summary DJabberd/IQ.pm »