Author: tgoettlicher Date: Thu Apr 19 12:21:15 2007 New Revision: 5410 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5410&view=rev Log: fix should wait for initial update until (K)NetworkManager has established connection (#231203) Modified: branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.cpp branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.h Modified: branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.cpp URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.cpp?rev=5410&r1=5409&r2=5410&view=diff ============================================================================== --- branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.cpp (original) +++ branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.cpp Thu Apr 19 12:21:15 2007 @@ -187,8 +187,41 @@ _stderr_buffer += QString::fromUtf8( buffer, buflen ); } + bool ZYppUpdater::networkOnline() const { + // When getNetworkStatus() returns "Establishing" we + // give KNetworkmanager some seconds to establish a + // network connection and try again. + + for (int attempt=0 ; attempt < 10; ++attempt) + { + if (attempt != 0) // wait 3s before we do + { // 2nd, 3rd. ... attempt + kdDebug() << "Network connection is getting established. waiting... " << endl; + sleep (3); + } + + kdDebug() << "Checking network connection..." << endl; + switch (getNetworkStatus()) + { + case 1: // NoNetworks + case 8: return true; // Online ==> true + + case 2: // Unreachable + case 3: // OfflineDisconnected + case 4: // OfflineFailed + case 5: // ShuttingDown + case 6: return false; // Offline ==> false + case 7: break; // Establishing ==> next attempt + } + } + return false; +} + + +int ZYppUpdater::getNetworkStatus() const +{ //enum EnumStatus { NoNetworks = 1, Unreachable, OfflineDisconnected, OfflineFailed, ShuttingDown, Offline, Establishing, Online }; int online = 1; @@ -213,7 +246,7 @@ } } - return (online == 8) || ( online == 1 ); + return online; } Modified: branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.h?rev=5410&r1=5409&r2=5410&view=diff ============================================================================== --- branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.h (original) +++ branches/SuSE-Linux-10_2-Branch/updater-kde/updater/zypp/ZYppUpdater.h Thu Apr 19 12:21:15 2007 @@ -129,6 +129,8 @@ private: bool networkOnline() const; + int getNetworkStatus() const; + void doCheckForUpdates(); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org