[mirrorbrain-commits] [opensuse-svn] r6588 - trunk/tools/download-redirector-v2/scanner

From: Novell Forge SVN <noreply_at_novell.com>
Date: Wed, 25 Feb 2009 08:14:49 -0700 (MST)
Author: poeml
Date: 2009-02-25 08:14:44 -0700 (Wed, 25 Feb 2009)
New Revision: 6588

Modified:
   trunk/tools/download-redirector-v2/scanner/scanner.pl
Log:
scanner:
- fix a two-fold bug in FTP scanning: 
  First, ignore bogus return values from Perls Net::FTP, which claim a 550
  status code when in fact a timeout happend (421). FTP servers may close
  connections when they are idle, and when the scanner (or database) takes to
  long to chew on a filelist, this may happen.
  Fix both issues by ignoring the reported 550, and attempting to reconnect.


Modified: trunk/tools/download-redirector-v2/scanner/scanner.pl
===================================================================
--- trunk/tools/download-redirector-v2/scanner/scanner.pl	2009-02-25 14:12:18 UTC (rev 6587)
+++ trunk/tools/download-redirector-v2/scanner/scanner.pl	2009-02-25 15:14:44 UTC (rev 6588)
@@ -652,10 +652,19 @@
   my $text = ftp_cont($ftp, "$url/$name");
 
   if(!ref($text) && $text =~ m/^(\d\d\d)\s/) {	# some FTP status code? Not good.
-    warn "$identifier: ftp status code $1, closing.\n";
+
+    # Bug: Net::FTP wrongly reports timeouts (421) as code 550:
+    # sunsite.informatik.rwth-aachen.de: ftp dir: ftp://sunsite.informatik.rwth-aachen.de/pub/linux/opensuse/distribution/11.0/repo/debug/suse/i686
+    # Net::FTP=GLOB(0x112f480)>>> CWD /pub/linux/opensuse/distribution/11.0/repo/debug/suse/i686
+    # Net::FTP=GLOB(0x112f480)<<< 421 Timeout.
+    # sunsite.informatik.rwth-aachen.de: ftp status code 550 (550 failed: ftp-cwd(/pub/linux/opensuse/distribution/11.0/repo/debug/suse/i686):  ), closing.
+
+    warn "$identifier: ftp status code $1. This *could* be a timeout; attempting a reconnect.\n";
     print "$identifier: $text" if $verbose > 2;
     ftp_close($ftp);
-    return;
+    $ftp = ftp_connect($identifier, "$url/$name", "anonymous", $scanner_email);
+    return unless defined $ftp;
+    $text = ftp_cont($ftp, "$url/$name");
   }  
 
   print "$identifier: ".join("\n", @$text)."\n" if $verbose > 2;

_______________________________________________
Opensuse-svn mailing list
Opensuse-svn_at_forge.novell.com
http://forge.novell.com/mailman/listinfo/opensuse-svn


_______________________________________________
mirrorbrain-commits mailing list

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on 2009-02-25Z15:15:16

This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:11 GMT