line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SockJS::Transport::XHRPolling; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
370
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use base 'SockJS::Transport::Base'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
358
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
3
|
|
|
3
|
0
|
6391
|
my $self = shift->SUPER::new(@_); |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
|
|
5
|
push @{$self->{allowed_methods}}, 'POST'; |
|
3
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
27
|
return $self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub dispatch_POST { |
17
|
3
|
|
|
3
|
0
|
6
|
my $self = shift; |
18
|
3
|
|
|
|
|
5
|
my ($env, $conn) = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return sub { |
21
|
3
|
|
|
3
|
|
21
|
my $respond = shift; |
22
|
|
|
|
|
|
|
|
23
|
3
|
100
|
66
|
|
|
7
|
if ($conn->is_connected && !$conn->is_reconnecting) { |
24
|
1
|
|
|
|
|
4
|
$self->_write($env, $respond, |
25
|
|
|
|
|
|
|
'c[2010,"Another connection still open"]'); |
26
|
1
|
|
|
|
|
4
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$conn->write_cb( |
30
|
|
|
|
|
|
|
sub { |
31
|
2
|
|
|
|
|
4
|
my $conn = shift; |
32
|
2
|
|
|
|
|
4
|
my ($message) = @_; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
8
|
$self->_write($env, $respond, $message); |
35
|
2
|
|
|
|
|
10
|
$conn->reconnecting; |
36
|
|
|
|
|
|
|
} |
37
|
2
|
|
|
|
|
11
|
); |
38
|
|
|
|
|
|
|
|
39
|
2
|
100
|
|
|
|
5
|
if ($conn->is_closed) { |
|
|
50
|
|
|
|
|
|
40
|
1
|
|
|
|
|
3
|
$conn->connected; |
41
|
1
|
|
|
|
|
2
|
$conn->close; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
elsif ($conn->is_connected) { |
44
|
0
|
|
|
|
|
0
|
$conn->reconnected; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else { |
47
|
1
|
|
|
|
|
4
|
$conn->write('o'); |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
3
|
$conn->connected; |
50
|
|
|
|
|
|
|
} |
51
|
3
|
|
|
|
|
40
|
}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _write { |
55
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
56
|
3
|
|
|
|
|
8
|
my ($env, $respond, $message) = @_; |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
8
|
$message .= "\n"; |
59
|
|
|
|
|
|
|
|
60
|
3
|
|
|
|
|
14
|
$respond->( |
61
|
|
|
|
|
|
|
[ |
62
|
|
|
|
|
|
|
200, [ 'Content-Type' => 'application/javascript; charset=UTF-8', ], |
63
|
|
|
|
|
|
|
[$message] |
64
|
|
|
|
|
|
|
] |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |