mirror of git://git.sysmocom.de/ofono
Refactor: Use GAtDisconnectFunc for ppp disconnect
The ppp argument to the current disconnect callback is useless as the ppp structure is most likely stored in user data anyway.
This commit is contained in:
parent
d6093b819f
commit
cc1bb46ffa
|
@ -59,11 +59,13 @@ void g_at_ppp_set_connect_function(GAtPPP *ppp, GAtPPPConnectFunc func,
|
|||
ppp->connect_data = user_data;
|
||||
}
|
||||
|
||||
void g_at_ppp_set_disconnect_function(GAtPPP *ppp,
|
||||
GAtPPPDisconnectFunc callback,
|
||||
gpointer user_data)
|
||||
void g_at_ppp_set_disconnect_function(GAtPPP *ppp, GAtDisconnectFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
ppp->disconnect_cb = callback;
|
||||
if (func == NULL)
|
||||
return;
|
||||
|
||||
ppp->disconnect_cb = func;
|
||||
ppp->disconnect_data = user_data;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "gat.h"
|
||||
|
||||
struct _GAtPPP;
|
||||
typedef struct _GAtPPP GAtPPP;
|
||||
|
||||
|
@ -39,14 +41,11 @@ typedef void (*GAtPPPConnectFunc)(GAtPPPConnectStatus success,
|
|||
const char *dns1, const char *dns2,
|
||||
gpointer user_data);
|
||||
|
||||
typedef void (*GAtPPPDisconnectFunc)(GAtPPP *ppp, gpointer user_data);
|
||||
|
||||
GAtPPP * g_at_ppp_new(GIOChannel *modem);
|
||||
void g_at_ppp_open(GAtPPP *ppp);
|
||||
void g_at_ppp_set_connect_function(GAtPPP *ppp, GAtPPPConnectFunc callback,
|
||||
gpointer user_data);
|
||||
void g_at_ppp_set_disconnect_function(GAtPPP *ppp,
|
||||
GAtPPPDisconnectFunc callback,
|
||||
void g_at_ppp_set_disconnect_function(GAtPPP *ppp, GAtDisconnectFunc func,
|
||||
gpointer user_data);
|
||||
void g_at_ppp_shutdown(GAtPPP *ppp);
|
||||
void g_at_ppp_ref(GAtPPP *ppp);
|
||||
|
|
|
@ -383,7 +383,7 @@ static void ppp_dead(GAtPPP *ppp)
|
|||
{
|
||||
/* notify interested parties */
|
||||
if (ppp->disconnect_cb)
|
||||
ppp->disconnect_cb(ppp, ppp->disconnect_data);
|
||||
ppp->disconnect_cb(ppp->disconnect_data);
|
||||
|
||||
if (g_atomic_int_get(&ppp->ref_count))
|
||||
return;
|
||||
|
|
|
@ -133,7 +133,7 @@ struct _GAtPPP {
|
|||
GQueue *recv_queue;
|
||||
GAtPPPConnectFunc connect_cb;
|
||||
gpointer connect_data;
|
||||
GAtPPPDisconnectFunc disconnect_cb;
|
||||
GAtDisconnectFunc disconnect_cb;
|
||||
gpointer disconnect_data;
|
||||
gint modem_watch;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue