diff options
-rw-r--r-- | gatchat/gatppp.c | 19 | ||||
-rw-r--r-- | gatchat/gatppp.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c index 000d18a9..2608d522 100644 --- a/gatchat/gatppp.c +++ b/gatchat/gatppp.c @@ -79,6 +79,7 @@ struct _GAtPPP { GAtSuspendFunc suspend_func; gpointer suspend_data; int fd; + gboolean suspended; }; void ppp_debug(GAtPPP *ppp, const char *str) @@ -480,6 +481,7 @@ static void ppp_proxy_suspend_net_interface(gpointer user_data) { GAtPPP *ppp = user_data; + ppp->suspended = TRUE; ppp_net_suspend_interface(ppp->net); if (ppp->suspend_func) @@ -507,6 +509,23 @@ void g_at_ppp_shutdown(GAtPPP *ppp) pppcp_signal_close(ppp->lcp); } +void g_at_ppp_resume(GAtPPP *ppp) +{ + if (ppp == NULL) + return; + + if (g_at_hdlc_get_io(ppp->hdlc) == NULL) { + io_disconnect(ppp); + return; + } + + ppp->suspended = FALSE; + g_at_io_set_disconnect_function(g_at_hdlc_get_io(ppp->hdlc), + io_disconnect, ppp); + ppp_net_resume_interface(ppp->net); + g_at_hdlc_resume(ppp->hdlc); +} + void g_at_ppp_ref(GAtPPP *ppp) { g_atomic_int_inc(&ppp->ref_count); diff --git a/gatchat/gatppp.h b/gatchat/gatppp.h index 365123a2..b1b02341 100644 --- a/gatchat/gatppp.h +++ b/gatchat/gatppp.h @@ -65,6 +65,7 @@ void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func, gpointer user_data); void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data); void g_at_ppp_shutdown(GAtPPP *ppp); +void g_at_ppp_resume(GAtPPP *ppp); void g_at_ppp_ref(GAtPPP *ppp); void g_at_ppp_unref(GAtPPP *ppp); |