Sorry, there was a missing block in the last patch. This one is correcyt
(I hope!)

Mark

diff --git a/apt-cacher b/apt-cacher
index 8ac5b91..8c7a9ed 100755
--- a/apt-cacher
+++ b/apt-cacher
@@ -1153,22 +1153,10 @@ sub connect_curlm {
            my $active_handles = 0;
            my $idcounter=1;
 
-           eval {
-               local $SIG{__DIE__} = 'IGNORE'; # Prevent log verbosity
-               local $SIG{ALRM} = sub {
-                   unless ($active_handles || $select->can_read(0)) {
-                       $select->remove($server);
-                       $server->close;
-                       die "libcurl inactive\n";
-                   }
-                   else {
-                       alarm $cfg->{curl_idle_timeout}
-                   }
-               };
-               alarm $cfg->{curl_idle_timeout}; # Set initial timeout
-               
+           while ($select->can_read($cfg->{curl_idle_timeout})) {
              LIBCURL_REQUEST:
-               while (my $client = $server->accept()) {
+               {
+                   my $client = $server->accept();
                    debug_message("libcurl: connection from $client");
                    # deal with connection here
                    while (<$client>) {
@@ -1182,7 +1170,7 @@ sub connect_curlm {
                            next LIBCURL_REQUEST;
                        }
                        $client->shutdown(0); # Finished reading
-                       
+
                        my $curl = ${&init_curl};
                        $easy{$idcounter}=[$client,$curl];
                        debug_message("Add curl handle #$idcounter: for 
$curl_req");
@@ -1208,7 +1196,6 @@ sub connect_curlm {
                        $active_handles++;
                        
                        while ($active_handles) {
-                           alarm $cfg->{curl_idle_timeout}; # Reset timeout
                            my $active_transfers = $curlm->perform;
                            if ($active_transfers != $active_handles) {
                                if (my ($id,$return_value) = $curlm->info_read) 
 {
@@ -1232,11 +1219,9 @@ sub connect_curlm {
                        }
                    }
                }
-           };
-           unlink ($cfg->{libcurl_socket});
-           if ($@ and $@ !~ /libcurl inactive\n/) {
-               die "Libcurl alarm error: $@"
            }
+
+           unlink ($cfg->{libcurl_socket});
            debug_message("Libcurl thread inactive. Exiting");
            exit(0);
        }




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to