mncc: Address the fixme and put the mncc_sock_state in gsm_network
Remove the unused mncc_sock_write_pending, switch over from the static s_state to net->mncc_state.
This commit is contained in:
parent
2a260ee9bc
commit
694c82d8e3
|
@ -11,6 +11,8 @@
|
|||
|
||||
#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3]
|
||||
|
||||
struct mncc_sock_state;
|
||||
|
||||
/* the data structure stored in msgb->cb for openbsc apps */
|
||||
struct openbsc_msgb_cb {
|
||||
unsigned char *bssgph;
|
||||
|
@ -247,6 +249,7 @@ struct gsm_network {
|
|||
struct gsmnet_stats stats;
|
||||
|
||||
/* layer 4 */
|
||||
struct mncc_sock_state *mncc_state;
|
||||
int (*mncc_recv) (struct gsm_network *net, struct msgb *msg);
|
||||
struct llist_head upqueue;
|
||||
struct llist_head trans_list;
|
||||
|
|
|
@ -43,9 +43,6 @@ struct mncc_sock_state {
|
|||
struct osmo_fd conn_bfd; /* fd for connection to lcr */
|
||||
};
|
||||
|
||||
/* FIXME: avoid this */
|
||||
static struct mncc_sock_state *g_state;
|
||||
|
||||
/* input from CC code into mncc_sock */
|
||||
int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg)
|
||||
{
|
||||
|
@ -53,7 +50,7 @@ int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg)
|
|||
int msg_type = mncc_in->msg_type;
|
||||
|
||||
/* Check if we currently have a MNCC handler connected */
|
||||
if (g_state->conn_bfd.fd < 0) {
|
||||
if (net->mncc_state->conn_bfd.fd < 0) {
|
||||
LOGP(DMNCC, LOGL_ERROR, "mncc_sock receives %s for external CC app "
|
||||
"but socket is gone\n", get_mncc_name(msg_type));
|
||||
if (msg_type != GSM_TCHF_FRAME &&
|
||||
|
@ -75,15 +72,10 @@ int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg)
|
|||
|
||||
/* Actually enqueue the message and mark socket write need */
|
||||
msgb_enqueue(&net->upqueue, msg);
|
||||
g_state->conn_bfd.when |= BSC_FD_WRITE;
|
||||
net->mncc_state->conn_bfd.when |= BSC_FD_WRITE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mncc_sock_write_pending(void)
|
||||
{
|
||||
g_state->conn_bfd.when |= BSC_FD_WRITE;
|
||||
}
|
||||
|
||||
/* FIXME: move this to libosmocore */
|
||||
int osmo_unixsock_listen(struct osmo_fd *bfd, int type, const char *path);
|
||||
|
||||
|
@ -292,7 +284,7 @@ int mncc_sock_init(struct gsm_network *net)
|
|||
return rc;
|
||||
}
|
||||
|
||||
g_state = state;
|
||||
net->mncc_state = state;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue