23 |
my $pid_path = "/tmp/sack.$port.pid"; |
my $pid_path = "/tmp/sack.$port.pid"; |
24 |
if ( -e $pid_path ) { |
if ( -e $pid_path ) { |
25 |
my $pid = read_file $pid_path; |
my $pid = read_file $pid_path; |
26 |
kill 0, $pid && kill 9, $pid && warn "[$port] kill old $pid\n"; |
kill 9, $pid; # warn "[$port] kill old $pid\n"; |
27 |
} |
} |
28 |
write_file $pid_path, $$; |
write_file $pid_path, $$; |
29 |
|
|
44 |
while ( 1 ) { |
while ( 1 ) { |
45 |
|
|
46 |
my $data = Storable::fd_retrieve( $client ); |
my $data = Storable::fd_retrieve( $client ); |
47 |
warn "[$port] <<<<\n"; |
# warn "[$port] <<<<\n"; |
48 |
warn "[$port] data = ", dump( $data ) if $self->{debug}; |
warn "[$port] data = ", dump( $data ) if $self->{debug}; |
49 |
|
|
50 |
my $result; |
my $result; |
74 |
$result = { 'error' => $data }; |
$result = { 'error' => $data }; |
75 |
} |
} |
76 |
|
|
77 |
warn "[$port] >>>>\n"; |
# warn "[$port] >>>>\n"; |
78 |
Storable::store_fd( $result => $client ); |
Storable::store_fd( $result => $client ); |
79 |
} |
} |
80 |
|
|