pppcp_signal_close(ppp->lcp);
}
+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)
+ ppp->suspend_func(ppp->suspend_data);
+}
+
gboolean g_at_ppp_listen(GAtPPP *ppp, GAtIO *io)
{
ppp->hdlc = g_at_hdlc_new_from_io(io);
ppp->suspended = FALSE;
g_at_hdlc_set_receive(ppp->hdlc, ppp_receive, ppp);
+ g_at_hdlc_set_suspend_function(ppp->hdlc,
+ ppp_proxy_suspend_net_interface, ppp);
g_at_io_set_disconnect_function(io, io_disconnect, ppp);
ppp_enter_phase(ppp, PPP_PHASE_ESTABLISHMENT);
ppp->suspended = FALSE;
g_at_hdlc_set_receive(ppp->hdlc, ppp_receive, ppp);
+ g_at_hdlc_set_suspend_function(ppp->hdlc,
+ ppp_proxy_suspend_net_interface, ppp);
g_at_hdlc_set_no_carrier_detect(ppp->hdlc, TRUE);
g_at_io_set_disconnect_function(io, io_disconnect, ppp);
ppp->debug_data = user_data;
}
-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)
- ppp->suspend_func(ppp->suspend_data);
-}
-
void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
gpointer user_data)
{
ppp->suspend_func = func;
ppp->suspend_data = user_data;
- g_at_hdlc_set_suspend_function(ppp->hdlc,
+
+ if (ppp->hdlc != NULL)
+ g_at_hdlc_set_suspend_function(ppp->hdlc,
ppp_proxy_suspend_net_interface, ppp);
}