summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-11-24 14:53:35 +0100
committerMarcel Holtmann <marcel@holtmann.org>2010-11-24 14:53:35 +0100
commitc678775fd7e36250be2c036e4746d8af0164fea9 (patch)
tree3268d22b18d7e1c4c00ff975178d639290cbcd7b /plugins
parent8a657ffc22119c65ee32c3c1f17c23950cf6c04e (diff)
downloadconnman-c678775fd7e36250be2c036e4746d8af0164fea9.tar.gz
connman-c678775fd7e36250be2c036e4746d8af0164fea9.tar.bz2
connman-c678775fd7e36250be2c036e4746d8af0164fea9.zip
Return to mainloop before starting DHCP procedure
Just before starting the DHCP procedure return to mainloop first. This fixes some cases where the interface is not yet up. This happens mainly when using Bluetooth PAN connections where the network interface will be newly created every single time.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dhcp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/dhcp.c b/plugins/dhcp.c
index 73c975de..e4dff18f 100644
--- a/plugins/dhcp.c
+++ b/plugins/dhcp.c
@@ -111,6 +111,15 @@ static void lease_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
connman_dhcp_bound(dhcp);
}
+static gboolean start_dhcp(gpointer user_data)
+{
+ GDHCPClient *dhcp_client = user_data;
+
+ g_dhcp_client_start(dhcp_client);
+
+ return FALSE;
+}
+
static int dhcp_request(struct connman_dhcp *dhcp)
{
GDHCPClient *dhcp_client;
@@ -155,7 +164,9 @@ static int dhcp_request(struct connman_dhcp *dhcp)
g_dhcp_client_ref(dhcp_client);
- return g_dhcp_client_start(dhcp_client);
+ g_timeout_add_seconds(0, start_dhcp, dhcp_client);
+
+ return 0;
}
static int dhcp_release(struct connman_dhcp *dhcp)