1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-03 12:24:14 +01:00

Make sure it's possible to stop a dhcp client that's in the process of getting a lease.

Have gui.py trigger connection status updates every .5 seconds if in a connecting state.
Fix typo in wicd-client.py
This commit is contained in:
Dan O'Reilly
2009-02-11 20:55:02 -05:00
parent 7ee121c15e
commit bae95355d7
6 changed files with 35 additions and 10 deletions

View File

@@ -44,7 +44,9 @@ class WiredConnectThread() -- Connection thread for wired
import re
import time
import threading
import os
import thread
from signal import SIGTERM
# wicd imports
import misc
@@ -202,7 +204,8 @@ class Controller(object):
iface = self.iface
if self.disconnect_script != None:
print 'Running disconnect script'
misc.ExecuteScript(expand_script_macros(self.disconnect_script, 'disconnection', *args))
misc.ExecuteScript(expand_script_macros(self.disconnect_script,
'disconnection', *args))
iface.ReleaseDHCP()
iface.SetAddress('0.0.0.0')
iface.FlushRoutes()
@@ -213,6 +216,14 @@ class Controller(object):
""" Release the DHCP lease for this interface. """
return self.iface.ReleaseDHCP()
def KillDHCP(self):
""" Kill the managed DHCP client if its in a connecting state. """
if (self.connecting_thread.is_connecting and
self.iface.dhcp_object):
if self.iface.dhcp_object.poll() is None:
os.kill(self.iface.dhcp_object.pid, SIGTERM)
self.iface.dhcp_object = None
def IsUp(self):
""" Calls the IsUp method for the wired interface.
@@ -404,7 +415,8 @@ class ConnectThread(threading.Thread):
print "Running DHCP"
dhcp_status = iface.StartDHCP()
if dhcp_status in ['no_dhcp_offers', 'dhcp_failed']:
self.abort_connection(dhcp_status)
if self.connect_result != "aborted":
self.abort_connection(dhcp_status)
return
@abortable