(Forwarding a message with an updated patch, presumably the bug report
address was omitted by mistake; sorry, Mark, if that's not the case.)

-- 
 \     “You are welcome to visit the cemetery where famous Russian and |
  `\    Soviet composers, artists, and writers are buried daily except |
_o__)                   Thursday.” —Russian orthodox monastery, Moscow |
Ben Finney <[email protected]>
--- Begin Message ---
On Thu, Nov 26, 2009 at 09:07:00AM +1100, Ben Finney wrote:
> On 25-Nov-2009, Mark Hindley wrote:
> > On Thu, Nov 26, 2009 at 09:02:24AM +1100, Ben Finney wrote:
> > > This patch (and the previous ones sent today) do not apply cleanly
> > > against ???apt-cacher??? 1.6.9; they are trying to patch a file
> > > (???{a,b}/apt-cacher???) that does not exist. Perhaps you're
> > > working against something other than version 1.6.9?
> > 
> > They are generated from my git source tree. Should be applied to
> > /usr/share/apt-cacher
> 
> I would rather (for ease of backing out the changes) build a new
> ???apt-cacher??? package from a modified version 1.6.9 source. Could you
> please generate patches to work that way?

OK. This should apply against 1.6.9 source with patch -p1

Mark

diff --git a/apt-cacher2 b/apt-cacher2
index 8ac5b91..8c7a9ed 100755
--- a/apt-cacher2
+++ b/apt-cacher2
@@ -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);
        }


--- End Message ---

Attachment: signature.asc
Description: Digital signature

Reply via email to