diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-04-01 20:26:24 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-04-01 20:26:24 -0700 |
commit | 7d6649680facbeca0c551dc26c50fe264213b4b8 (patch) | |
tree | a1c44c3a605dbb30265d57df70114b36be5cd406 | |
parent | cdc1e3c31b74adc010efd9dddd7502806ff0e555 (diff) | |
download | ofono-7d6649680facbeca0c551dc26c50fe264213b4b8.tar.bz2 |
Remove PPP event_queue handling and process events directly
-rw-r--r-- | gatchat/gatppp.c | 3 | ||||
-rw-r--r-- | gatchat/ppp.c | 67 | ||||
-rw-r--r-- | gatchat/ppp.h | 1 |
3 files changed, 27 insertions, 44 deletions
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c index bc607a8f..8cac7195 100644 --- a/gatchat/gatppp.c +++ b/gatchat/gatppp.c @@ -145,9 +145,6 @@ GAtPPP *g_at_ppp_new(GIOChannel *modem) ppp->pfc = FALSE; ppp->acfc = FALSE; - /* allocate the queues */ - ppp->event_queue = g_queue_new(); - ppp->index = 0; /* initialize the lcp state */ diff --git a/gatchat/ppp.c b/gatchat/ppp.c index 887a6308..0e4e8354 100644 --- a/gatchat/ppp.c +++ b/gatchat/ppp.c @@ -411,9 +411,6 @@ static void ppp_dead(GAtPPP *ppp) if (g_atomic_int_get(&ppp->ref_count)) return; - /* clean up all the queues */ - g_queue_free(ppp->event_queue); - /* cleanup modem channel */ g_source_remove(ppp->modem_watch); g_io_channel_unref(ppp->modem); @@ -461,48 +458,38 @@ static void ppp_transition_phase(GAtPPP *ppp, enum ppp_phase phase) } } -static void ppp_handle_event(GAtPPP *ppp) -{ - enum ppp_event event; - - while ((event = GPOINTER_TO_UINT(g_queue_pop_head(ppp->event_queue)))){ - switch (event) { - case PPP_UP: - /* causes transition to ppp establishment */ - ppp_transition_phase(ppp, PPP_ESTABLISHMENT); - break; - case PPP_OPENED: - ppp_transition_phase(ppp, PPP_AUTHENTICATION); - break; - case PPP_CLOSING: - /* causes transition to termination phase */ - ppp_transition_phase(ppp, PPP_TERMINATION); - break; - case PPP_DOWN: - /* cases transition to dead phase */ - ppp_transition_phase(ppp, PPP_DEAD); - break; - case PPP_NONE: - case PPP_SUCCESS: - /* causes transition to network phase */ - ppp_transition_phase(ppp, PPP_NETWORK); - break; - case PPP_FAIL: - if (ppp->phase == PPP_ESTABLISHMENT) - ppp_transition_phase(ppp, PPP_DEAD); - else if (ppp->phase == PPP_AUTHENTICATION) - ppp_transition_phase(ppp, PPP_TERMINATION); - } - } -} - /* * send the event handler a new event to process */ void ppp_generate_event(GAtPPP *ppp, enum ppp_event event) { - g_queue_push_tail(ppp->event_queue, GUINT_TO_POINTER(event)); - ppp_handle_event(ppp); + switch (event) { + case PPP_UP: + /* causes transition to ppp establishment */ + ppp_transition_phase(ppp, PPP_ESTABLISHMENT); + break; + case PPP_OPENED: + ppp_transition_phase(ppp, PPP_AUTHENTICATION); + break; + case PPP_CLOSING: + /* causes transition to termination phase */ + ppp_transition_phase(ppp, PPP_TERMINATION); + break; + case PPP_DOWN: + /* cases transition to dead phase */ + ppp_transition_phase(ppp, PPP_DEAD); + break; + case PPP_NONE: + case PPP_SUCCESS: + /* causes transition to network phase */ + ppp_transition_phase(ppp, PPP_NETWORK); + break; + case PPP_FAIL: + if (ppp->phase == PPP_ESTABLISHMENT) + ppp_transition_phase(ppp, PPP_DEAD); + else if (ppp->phase == PPP_AUTHENTICATION) + ppp_transition_phase(ppp, PPP_TERMINATION); + } } void ppp_set_auth(GAtPPP *ppp, guint8* auth_data) diff --git a/gatchat/ppp.h b/gatchat/ppp.h index 9e5c5a70..8c38381d 100644 --- a/gatchat/ppp.h +++ b/gatchat/ppp.h @@ -130,7 +130,6 @@ struct _GAtPPP { guint32 xmit_accm[8]; guint32 recv_accm; GIOChannel *modem; - GQueue *event_queue; GAtPPPConnectFunc connect_cb; gpointer connect_data; GAtDisconnectFunc disconnect_cb; |