From 4f92863478e39595fd8d5afdd927426367b1ccc1 Mon Sep 17 00:00:00 2001 From: Eugeni Dodonov Date: Tue, 31 Mar 2009 14:48:16 +0000 Subject: Checking for connection to be up during installation. --- lib/network/connection.pm | 2 ++ lib/network/connection/isdn.pm | 2 ++ lib/network/connection/ppp.pm | 2 ++ lib/network/connection/xdsl.pm | 2 ++ lib/network/netconnect.pm | 11 ++++++++++- 5 files changed, 18 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/network/connection.pm b/lib/network/connection.pm index aa05ab6..d059558 100644 --- a/lib/network/connection.pm +++ b/lib/network/connection.pm @@ -99,6 +99,8 @@ sub get_interface { sub get_metric { 60 } +sub get_up_timeout { 10 } + sub get_status { my ($self) = @_; require network::tools; diff --git a/lib/network/connection/isdn.pm b/lib/network/connection/isdn.pm index e26d15c..1b8debc 100644 --- a/lib/network/connection/isdn.pm +++ b/lib/network/connection/isdn.pm @@ -15,6 +15,8 @@ sub get_devices { } sub get_metric { 30 } +sub get_up_timeout { 20 } + use network::connection::isdn::consts; use modules; use run_program; diff --git a/lib/network/connection/ppp.pm b/lib/network/connection/ppp.pm index 459f6cc..37fabb3 100644 --- a/lib/network/connection/ppp.pm +++ b/lib/network/connection/ppp.pm @@ -56,6 +56,8 @@ sub get_options { sub get_tty_device { "/dev/modem" } +sub get_up_timeout { 20 } + sub build_ifcfg_settings { my ($self) = @_; my $modemport = $self->get_tty_device; diff --git a/lib/network/connection/xdsl.pm b/lib/network/connection/xdsl.pm index 4352be7..e55dd24 100644 --- a/lib/network/connection/xdsl.pm +++ b/lib/network/connection/xdsl.pm @@ -24,6 +24,8 @@ sub get_devices() { sub get_metric { 25 } sub get_interface() { "ppp0" } +sub get_up_timeout { 20 } + my @non_ppp_protocols = qw(static dhcp); sub uses_ppp { my ($self) = @_; diff --git a/lib/network/netconnect.pm b/lib/network/netconnect.pm index 1e2a614..f344b34 100644 --- a/lib/network/netconnect.pm +++ b/lib/network/netconnect.pm @@ -311,7 +311,16 @@ If you do not know it, keep the preselected protocol.") }, $connection->connect; #- FIXME: should use network::test for ppp (after future merge with network::connection) #- or start interface synchronously - services::start('network-up') unless $::isInstall; + if (!$::isInstall) { + services::start('network-up'); + } else { + my $timeout = $connection->get_up_timeout; + while ($timeout--) { + my $status = $connection->get_status; + last if $status; + sleep 1; + } + } $success = $connection->get_status(); $has_internet = network::tools::connected(); } -- cgit v1.2.1