line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::FTP::Client::Transfer::Active; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
860
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
66
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
52
|
|
5
|
2
|
|
|
2
|
|
11
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
6
|
2
|
|
|
2
|
|
732
|
use 5.010; |
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
12
|
use AnyEvent; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
8
|
2
|
|
|
2
|
|
13
|
use AnyEvent::Socket qw( tcp_server ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1038
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'AnyEvent::FTP::Client::Transfer'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Active transfer class for asynchronous ftp client |
13
|
|
|
|
|
|
|
our $VERSION = '0.17'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub BUILD |
16
|
|
|
|
|
|
|
{ |
17
|
29
|
|
|
29
|
0
|
671
|
my($self) = @_; |
18
|
|
|
|
|
|
|
|
19
|
29
|
|
|
|
|
318
|
my $local = $self->convert_local($self->local); |
20
|
|
|
|
|
|
|
|
21
|
29
|
|
|
|
|
94
|
my $count = 0; |
22
|
29
|
|
|
|
|
101
|
my $guard; |
23
|
|
|
|
|
|
|
$guard = tcp_server $self->client->{my_ip}, undef, sub { |
24
|
29
|
|
|
29
|
|
3437
|
my($fh, $host, $port) = @_; |
25
|
|
|
|
|
|
|
# TODO double check the host/port combo here. |
26
|
|
|
|
|
|
|
|
27
|
29
|
50
|
|
|
|
122
|
return close $fh if ++$count > 1; |
28
|
|
|
|
|
|
|
|
29
|
29
|
|
|
|
|
200
|
undef $guard; # close to additional connections. |
30
|
|
|
|
|
|
|
|
31
|
29
|
|
|
|
|
354
|
$self->xfer($fh,$local); |
32
|
|
|
|
|
|
|
}, sub { |
33
|
|
|
|
|
|
|
|
34
|
29
|
|
|
29
|
|
8762
|
my($fh, $host, $port) = @_; |
35
|
29
|
|
|
|
|
359
|
my $ip_and_port = join(',', split(/\./, $self->client->{my_ip}), $port >> 8, $port & 0xff); |
36
|
|
|
|
|
|
|
|
37
|
29
|
|
|
|
|
80
|
my $w; |
38
|
|
|
|
|
|
|
$w = AnyEvent->timer(after => 0, cb => sub { |
39
|
29
|
100
|
|
|
|
1668
|
$self->push_command( |
40
|
|
|
|
|
|
|
[ PORT => $ip_and_port ], |
41
|
|
|
|
|
|
|
($self->restart > 0 ? ([ REST => $self->restart ]) : ()), |
42
|
|
|
|
|
|
|
$self->command, |
43
|
|
|
|
|
|
|
); |
44
|
29
|
|
|
|
|
549
|
undef $w; |
45
|
29
|
|
|
|
|
522
|
}); |
46
|
29
|
|
|
|
|
541
|
}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->cv->cb(sub { |
49
|
20
|
|
33
|
20
|
|
298
|
my $res = eval { shift->recv } // $@; |
|
20
|
|
|
|
|
85
|
|
50
|
20
|
|
|
|
|
145
|
$self->emit('close' => $res); |
51
|
29
|
|
|
|
|
3192
|
}); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
package AnyEvent::FTP::Client::Transfer::Active::Fetch; |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
2
|
|
16
|
use Moo; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
58
|
|
|
|
|
|
|
extends 'AnyEvent::FTP::Client::Transfer::Active'; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
with 'AnyEvent::FTP::Client::Role::FetchTransfer'; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
package AnyEvent::FTP::Client::Transfer::Active::Store; |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
2
|
|
737
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
65
|
|
|
|
|
|
|
extends 'AnyEvent::FTP::Client::Transfer::Active'; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
with 'AnyEvent::FTP::Client::Role::StoreTransfer'; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
package AnyEvent::FTP::Client::Transfer::Active::List; |
70
|
|
|
|
|
|
|
|
71
|
2
|
|
|
2
|
|
732
|
use Moo; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
11
|
|
72
|
|
|
|
|
|
|
extends 'AnyEvent::FTP::Client::Transfer::Active'; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
with 'AnyEvent::FTP::Client::Role::ListTransfer'; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |