Corretto baco per gestione dead thread

This commit is contained in:
cmaffio
2016-03-25 09:34:22 +01:00
parent ffbe31effc
commit 6d5e101b45

View File

@@ -60,7 +60,19 @@ while (1) {
if(!$puntatore or !$puntatore->is_running ) {
print "Rilevato termine processo $variabile, riavvio" if ($verbose);
$puntatore->detach();
$proc{$variabile} = threads->new(\&$variabile);
if ($variabile eq "database") {
$proc{'database'} = threads->create(\&database);
} else {
$query = "SELECT id, ip, port FROM proxy_conn WHERE nome = '$variabile'";
$sts = $dbmysql->prepare($query);
$sts->execute ();
$ref = $sts->fetchrow_hashref;
my $id = $$ref{'id'};
my $ip = $$ref{'ip'};
my $port = $$ref{'port'};
$proc{$$variabile} = threads->create(\&conntrack, $id, $ip, $port);
}
}
}
@@ -108,7 +120,7 @@ sub conntrack {
my $remote_RECEIVE = $6;
my $thread_ID = $7;
print "$sess_id - IP: $remote_IP - ID: $thread_ID - Invati: $remote_SEND - Ricevuti: $remote_RECEIVE\n" if ($verbose);
printf ("$sess_id - IP: %-15s - ID: %-12s - Inviati: %10d - Ricevuti: %10d\n", $remote_IP, $thread_ID, $remote_SEND, $remote_RECEIVE) if ($verbose);
my $query = " UPDATE
proxy_dati