diff options
author | Denis Kenzior <denkenz@gmail.com> | 2011-02-28 14:26:26 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-02-28 16:13:56 -0600 |
commit | ea56a7106759bb519775081bb90618fbcf91879e (patch) | |
tree | 7185edc710655ee47496ac17d05c325571436d0b /gatchat/gatppp.c | |
parent | 0dc8e5e588d7f12a9836582bf8b41a31572a7271 (diff) | |
download | ofono-ea56a7106759bb519775081bb90618fbcf91879e.tar.bz2 |
gatppp: Delay signaling ppp_down
Delay signaling of ppp_down until we exit the GAtHDLC read handler.
Otherwise exchanging the read handler on GAtIO might lead to funny
double consumption problems.
Diffstat (limited to 'gatchat/gatppp.c')
-rw-r--r-- | gatchat/gatppp.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c index 21456bda..f8b329b6 100644 --- a/gatchat/gatppp.c +++ b/gatchat/gatppp.c @@ -75,6 +75,7 @@ struct _GAtPPP { GAtDebugFunc debugf; gpointer debug_data; gboolean sta_pending; + guint ppp_dead_source; }; void ppp_debug(GAtPPP *ppp, const char *str) @@ -85,14 +86,20 @@ void ppp_debug(GAtPPP *ppp, const char *str) ppp->debugf(str, ppp->debug_data); } -static void ppp_dead(GAtPPP *ppp) +static gboolean ppp_dead(gpointer userdata) { + GAtPPP *ppp = userdata; + DBG(ppp, ""); + ppp->ppp_dead_source = 0; + /* notify interested parties */ if (ppp->disconnect_cb) ppp->disconnect_cb(ppp->disconnect_reason, ppp->disconnect_data); + + return FALSE; } static void sta_sent(gpointer userdata) @@ -243,7 +250,7 @@ static inline void ppp_enter_phase(GAtPPP *ppp, enum ppp_phase phase) ppp->phase = phase; if (phase == PPP_PHASE_DEAD && ppp->sta_pending == FALSE) - ppp_dead(ppp); + ppp->ppp_dead_source = g_idle_add(ppp_dead, ppp); } void ppp_set_auth(GAtPPP *ppp, const guint8* auth_data) @@ -498,6 +505,11 @@ void g_at_ppp_unref(GAtPPP *ppp) lcp_free(ppp->lcp); ipcp_free(ppp->ipcp); + if (ppp->ppp_dead_source) { + g_source_remove(ppp->ppp_dead_source); + ppp->ppp_dead_source = 0; + } + g_at_hdlc_unref(ppp->hdlc); g_free(ppp); |