summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-02-07 10:45:52 +0000
committerFrancois Pons <fpons@mandriva.com>2001-02-07 10:45:52 +0000
commitf178a0b654b57e5eb443cee76cd3170bfef0bc4a (patch)
tree1944cce64b66995308b00fc7510fac62b6198e4e
parentd8ec21bed269b44c6ec416ebbbe2f43464d48d50 (diff)
downloaddrakx-f178a0b654b57e5eb443cee76cd3170bfef0bc4a.tar
drakx-f178a0b654b57e5eb443cee76cd3170bfef0bc4a.tar.gz
drakx-f178a0b654b57e5eb443cee76cd3170bfef0bc4a.tar.bz2
drakx-f178a0b654b57e5eb443cee76cd3170bfef0bc4a.tar.xz
drakx-f178a0b654b57e5eb443cee76cd3170bfef0bc4a.zip
now fully fixed ftp connection (and http too) caused by forked DrakX
with latent ftp connection.
-rw-r--r--perl-install/ftp.pm4
-rw-r--r--perl-install/http.pm1
-rw-r--r--perl-install/pkgs.pm20
3 files changed, 13 insertions, 12 deletions
diff --git a/perl-install/ftp.pm b/perl-install/ftp.pm
index b21058c30..7784bb529 100644
--- a/perl-install/ftp.pm
+++ b/perl-install/ftp.pm
@@ -50,14 +50,14 @@ sub new {
sub getFile {
my ($f, @para) = @_;
+ $f eq 'XXX' and rewindGetFile(), return; #- special case to force closing connection.
foreach (1..3) {
my ($ftp, $retr) = new(@para ? @para : fromEnv);
$$retr->close if $$retr;
- $f eq 'XXX' and return; #- special case to force closing connection on CD, really necessary here!
$$retr = $ftp->retr($f) and return $$retr;
rewindGetFile();
log::l("ftp get failed, sleeping before trying again");
- sleep 2;
+ sleep 1;
}
}
diff --git a/perl-install/http.pm b/perl-install/http.pm
index eb8ca0a09..5c8408478 100644
--- a/perl-install/http.pm
+++ b/perl-install/http.pm
@@ -16,6 +16,7 @@ sub getFile {
$path .= "/$_[0]";
$sock->close if $sock;
+ $_[0] eq 'XXX' and return; #- force closing connection.
$sock = IO::Socket::INET->new(PeerAddr => $host,
PeerPort => $port || 80,
Proto => 'tcp',
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 0baccea9e..a9af7f72d 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -394,6 +394,7 @@ sub psUsingHdlist {
$packages->{mediums}{$medium} and return;
my $m = $packages->{mediums}{$medium} = { hdlist => $hdlist,
+ method => $method,
medium => $medium,
rpmsdir => $rpmsdir, #- where is RPMS directory.
descr => $descr,
@@ -1196,17 +1197,15 @@ sub install($$$;$$) {
#- extract headers for parent as they are used by callback.
extractHeaders($prefix, \@transToInstall, $media->{$medium});
- #- reset file descriptor open for main process but
- #- make sure error trying to change from hdlist are
- #- trown from main process too.
- install_any::getFile(packageFile($transToInstall[0]), $transToInstall[0][$MEDIUM]{descr});
- #- and make sure there are no staling open file descriptor too!
+ if ($media->{$medium}{method} eq 'cdrom') {
+ #- reset file descriptor open for main process but
+ #- make sure error trying to change from hdlist are
+ #- trown from main process too.
+ install_any::getFile(packageFile($transToInstall[0]), $transToInstall[0][$MEDIUM]{descr});
+ }
+ #- and make sure there are no staling open file descriptor too (before forking)!
install_any::getFile('XXX');
- #- reset ftp handlers before forking, otherwise well ;-(
- #require ftp;
- #ftp::rewindGetFile();
-
local (*INPUT, *OUTPUT); pipe INPUT, OUTPUT;
if (my $pid = fork()) {
close OUTPUT;
@@ -1254,7 +1253,8 @@ sub install($$$;$$) {
sub { #- installCallback
print OUTPUT join(":", @_), "\n"; },
1);
- log::l("rpmRunTransactions done");
+ log::l("rpmRunTransactions done, now trying to close still opened fd");
+ install_any::getFile('XXX'); #- close still opened fd.
if (@probs) {
my %parts;