From 1009d9ad255561b32f619bdabf35703f0101ca07 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 2 Mar 2005 11:45:39 +0000 Subject: refresh every second, and do not reread network conf at each refresh --- perl-install/standalone/net_applet | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet index 5473320bc..0972e0890 100644 --- a/perl-install/standalone/net_applet +++ b/perl-install/standalone/net_applet @@ -27,7 +27,10 @@ is_running('net_applet') and die "net_applet already running\n"; my $prog_name = "/usr/bin/net_applet"; my $current_md5 = md5file($prog_name); -my ($netcnx, $intf); +my $netcnx = {}; +my $netc = {}; +my $intf = {}; +network::netconnect::read_net_conf($netcnx, $netc, $intf); my $watched_interface; my %appletstate = ( @@ -152,10 +155,6 @@ sub netMonitor() { checkNetwork(); } sub checkNetwork() { - $netcnx = {}; - my $netc = {}; - $intf = {}; - network::netconnect::read_net_conf($netcnx, $netc, $intf); my ($gw_intf, $is_up, $gw_address, $dns_server) = network::tools::get_internet_connection($netc, $intf); my ($gw_intf, $is_up, $gw_address) = $watched_interface ? ($watched_interface, network::tools::get_interface_status($watched_interface)) : @@ -166,7 +165,8 @@ sub checkNetwork() { if ($new_md5 ne $current_md5) { exec($prog_name) } } sub checkNetworkForce() { - $current_state = "refresh"; + network::netconnect::read_net_conf($netcnx, $netc, $intf); + undef $current_state; checkNetwork(); } sub getIP { @@ -177,7 +177,7 @@ sub getIP { return wantarray() ? @ip : $ip[0]; } sub cronNetwork() { - $timeout = Glib::Timeout->add(5*1000, sub { + $timeout = Glib::Timeout->add(1000, sub { checkNetwork(); 1; }); -- cgit v1.2.1