From: Marcel Holtmann Date: Fri, 11 Jan 2008 18:54:40 +0000 (+0100) Subject: Fix IO handling for the control channel X-Git-Tag: 0.1~429 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e66c4ceb3685bc93ca067994f083f18d39f42aa7;p=platform%2Fupstream%2Fconnman.git Fix IO handling for the control channel --- diff --git a/plugins/supplicant.c b/plugins/supplicant.c index 583b1f7..e58415c 100644 --- a/plugins/supplicant.c +++ b/plugins/supplicant.c @@ -77,10 +77,8 @@ static gboolean control_event(GIOChannel *chan, gsize len; GIOError err; - if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) { - g_io_channel_unref(chan); + if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) return FALSE; - } memset(buf, 0, sizeof(buf)); @@ -88,7 +86,6 @@ static gboolean control_event(GIOChannel *chan, if (err) { if (err == G_IO_ERROR_AGAIN) return TRUE; - g_io_channel_unref(chan); return FALSE; } @@ -158,8 +155,6 @@ static int open_control(struct supplicant_task *task) exec_cmd(task, "ATTACH"); exec_cmd(task, "ADD_NETWORK"); - g_io_channel_unref(task->channel); - return 0; } @@ -242,13 +237,14 @@ int __supplicant_stop(struct connman_iface *iface) tasks = g_slist_remove(tasks, task); + exec_cmd(task, "DISABLE_NETWORK 0"); exec_cmd(task, "DETACH"); sleep(1); kill(task->pid, SIGTERM); - //close(task->socket); + g_io_channel_shutdown(task->channel, TRUE, NULL); g_io_channel_unref(task->channel); snprintf(pathname, sizeof(pathname),