Eyes Above The Waves

Robert O'Callahan. Christian. Repatriate Kiwi. Hacker.

Tuesday 5 December 2006

NetworkManager, dbus and Offline Status

I've finally checked in support for offline status detection on Linux. We hook into dbus to listen for signals from NetworkManager saying that it has gone offline or gone online. I originally did this work about a year ago but it's taken ... a while ... to get reviewed. After I wrote the infrastructure the Windows support actually got written and landed while I was waiting for review on the Linux bits, so Windows has had this on trunk for a while and it even landed in FF2.

Anyway, now if your network link goes down, FF will automatically switch to offline mode and if the link comes back, FF will switch to online mode. If you manually change the "Work Offline" state then FF will stop switching automatically for the duration of your FF session.

Other Xulrunner apps can take advantage of this too. By default the IOService will watch for network link status changes and automatically toggle its online/offline state. But if an application wants to do things differently, it can tell the IOService to stop the automatic tracking. Then the application can listen for network link status changes via nsIObserver and modify IOService's online/offline status as desired.

We still want Mac support. Also, if you happen to be using a Linux distribution without dbus or without NetworkManager, the build will still work, you just won't get the automation.



Comments

Juan
To be fair, the Windows code wasn't written after you wrote the infrastructure code - I'd written the Windows code several years before, and was waiting for a review. If you hadn't landed the infrastructure code, I don't think I'd ever have gotten one. So, thanks for landing it.
Eduardo
Is it possible to disable the automatic switch to offline mode on Linux for FF2?
It's very annoying when I'm not connected to any networks but I'm trying to access a web page on a web server running locally.
Miguel
I second Eduardo's comments... Network Manager is very unstable and will connect me to undesired networks and disconnect me all the time.
Sometime I am unable to get NM up and running again so I have to manually connect to the internet and then annoyingly, firefox remains in "offline" mode.