diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-10-14 16:34:35 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-10-15 16:15:17 -0500 |
commit | d4d16176840600ba4ca4e8104e0e8b7d82de38fd (patch) | |
tree | 5f3020284a87f61ff1efc1055a88a2a3dfc5bfd8 /gatchat/gatmux.c | |
parent | a8af38d209ecefcd9ab17670a18f445e95f575e2 (diff) | |
download | ofono-d4d16176840600ba4ca4e8104e0e8b7d82de38fd.tar.bz2 |
Fix: Do not send shutdown more than once
Diffstat (limited to 'gatchat/gatmux.c')
-rw-r--r-- | gatchat/gatmux.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gatchat/gatmux.c b/gatchat/gatmux.c index 0b42ebcf..96576de5 100644 --- a/gatchat/gatmux.c +++ b/gatchat/gatmux.c @@ -89,6 +89,7 @@ struct _GAtMux { void *driver_data; /* Driver data */ char buf[MUX_BUFFER_SIZE]; /* Buffer on the main mux */ int buf_used; /* Bytes of buf being used */ + gboolean shutdown; }; struct mux_setup_data { @@ -545,6 +546,7 @@ GAtMux *g_at_mux_new(GIOChannel *channel, const GAtMuxDriver *driver) mux->ref_count = 1; mux->driver = driver; + mux->shutdown = TRUE; mux->channel = channel; g_io_channel_ref(channel); @@ -596,6 +598,8 @@ gboolean g_at_mux_start(GAtMux *mux) G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, received_data, mux, NULL); + mux->shutdown = FALSE; + return TRUE; } @@ -603,6 +607,9 @@ gboolean g_at_mux_shutdown(GAtMux *mux) { int i; + if (mux->shutdown == TRUE) + return FALSE; + if (mux->channel == NULL) return FALSE; @@ -619,6 +626,8 @@ gboolean g_at_mux_shutdown(GAtMux *mux) if (mux->driver->shutdown) mux->driver->shutdown(mux); + mux->shutdown = TRUE; + return TRUE; } |