mirror of git://git.sysmocom.de/ofono
Fix: Do not send shutdown more than once
This commit is contained in:
parent
a8af38d209
commit
d4d1617684
|
@ -89,6 +89,7 @@ struct _GAtMux {
|
||||||
void *driver_data; /* Driver data */
|
void *driver_data; /* Driver data */
|
||||||
char buf[MUX_BUFFER_SIZE]; /* Buffer on the main mux */
|
char buf[MUX_BUFFER_SIZE]; /* Buffer on the main mux */
|
||||||
int buf_used; /* Bytes of buf being used */
|
int buf_used; /* Bytes of buf being used */
|
||||||
|
gboolean shutdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mux_setup_data {
|
struct mux_setup_data {
|
||||||
|
@ -545,6 +546,7 @@ GAtMux *g_at_mux_new(GIOChannel *channel, const GAtMuxDriver *driver)
|
||||||
|
|
||||||
mux->ref_count = 1;
|
mux->ref_count = 1;
|
||||||
mux->driver = driver;
|
mux->driver = driver;
|
||||||
|
mux->shutdown = TRUE;
|
||||||
|
|
||||||
mux->channel = channel;
|
mux->channel = channel;
|
||||||
g_io_channel_ref(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,
|
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
|
||||||
received_data, mux, NULL);
|
received_data, mux, NULL);
|
||||||
|
|
||||||
|
mux->shutdown = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,6 +607,9 @@ gboolean g_at_mux_shutdown(GAtMux *mux)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (mux->shutdown == TRUE)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (mux->channel == NULL)
|
if (mux->channel == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -619,6 +626,8 @@ gboolean g_at_mux_shutdown(GAtMux *mux)
|
||||||
if (mux->driver->shutdown)
|
if (mux->driver->shutdown)
|
||||||
mux->driver->shutdown(mux);
|
mux->driver->shutdown(mux);
|
||||||
|
|
||||||
|
mux->shutdown = TRUE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue