diff options
-rw-r--r-- | gatchat/gatio.c | 29 | ||||
-rw-r--r-- | gatchat/gatio.h | 2 |
2 files changed, 13 insertions, 18 deletions
diff --git a/gatchat/gatio.c b/gatchat/gatio.c index 63bfd827..05c2e753 100644 --- a/gatchat/gatio.c +++ b/gatchat/gatio.c @@ -208,6 +208,18 @@ GAtIO *g_at_io_ref(GAtIO *io) return io; } +static gboolean io_shutdown(GAtIO *io) +{ + /* Don't trigger user disconnect on shutdown */ + io->user_disconnect = NULL; + io->user_disconnect_data = NULL; + + if (io->read_watch > 0) + g_source_remove(io->read_watch); + + return TRUE; +} + void g_at_io_unref(GAtIO *io) { gboolean is_zero; @@ -220,7 +232,7 @@ void g_at_io_unref(GAtIO *io) if (is_zero == FALSE) return; - g_at_io_shutdown(io); + io_shutdown(io); /* glib delays the destruction of the watcher until it exits, this * means we can't free the data just yet, even though we've been @@ -233,21 +245,6 @@ void g_at_io_unref(GAtIO *io) g_free(io); } -gboolean g_at_io_shutdown(GAtIO *io) -{ - if (io->channel == NULL) - return FALSE; - - /* Don't trigger user disconnect on shutdown */ - io->user_disconnect = NULL; - io->user_disconnect_data = NULL; - - if (io->read_watch > 0) - g_source_remove(io->read_watch); - - return TRUE; -} - gboolean g_at_io_set_disconnect_function(GAtIO *io, GAtDisconnectFunc disconnect, gpointer user_data) { diff --git a/gatchat/gatio.h b/gatchat/gatio.h index 87eb633b..68b6ea8e 100644 --- a/gatchat/gatio.h +++ b/gatchat/gatio.h @@ -43,8 +43,6 @@ GIOChannel *g_at_io_get_channel(GAtIO *io); GAtIO *g_at_io_ref(GAtIO *io); void g_at_io_unref(GAtIO *io); -gboolean g_at_io_shutdown(GAtIO *io); - gboolean g_at_io_set_read_handler(GAtIO *io, GAtIOReadFunc read_handler, gpointer user_data); |