Skip to content
Snippets Groups Projects
Commit fb5fddd9 authored by Richard Mudgett's avatar Richard Mudgett
Browse files

Extract sig_ss7_init_linkset() to sig_ss7.

Also found a place where sig_pri_init_pri() was inlined and called it
instead.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270298 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent a806196f
No related branches found
No related tags found
No related merge requests found
......@@ -14329,11 +14329,8 @@ static int dahdi_restart(void)
 
memset(pris, 0, sizeof(pris));
for (i = 0; i < NUM_SPANS; i++) {
ast_mutex_init(&pris[i].pri.lock);
pris[i].pri.master = AST_PTHREADT_NULL;
for (j = 0; j < SIG_PRI_NUM_DCHANS; j++)
pris[i].pri.fds[j] = -1;
}
sig_pri_init_pri(&pris[i].pri);
}
pri_set_error(dahdi_pri_error);
pri_set_message(dahdi_pri_message);
#endif
......@@ -14345,10 +14342,7 @@ static int dahdi_restart(void)
 
memset(linksets, 0, sizeof(linksets));
for (i = 0; i < NUM_SPANS; i++) {
ast_mutex_init(&linksets[i].ss7.lock);
linksets[i].ss7.master = AST_PTHREADT_NULL;
for (j = 0; j < SIG_SS7_NUM_DCHANS; j++)
linksets[i].ss7.fds[j] = -1;
sig_ss7_init_linkset(&linksets[i].ss7);
}
ss7_set_error(dahdi_ss7_error);
ss7_set_message(dahdi_ss7_message);
......@@ -17407,9 +17401,7 @@ static int load_module(void)
#if defined(HAVE_PRI) || defined(HAVE_SS7)
int y;
#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
#if defined(HAVE_SS7)
int i;
#endif /* defined(HAVE_SS7) */
#ifdef HAVE_PRI
memset(pris, 0, sizeof(pris));
for (y = 0; y < NUM_SPANS; y++) {
......@@ -17442,10 +17434,7 @@ static int load_module(void)
#if defined(HAVE_SS7)
memset(linksets, 0, sizeof(linksets));
for (y = 0; y < NUM_SPANS; y++) {
ast_mutex_init(&linksets[y].ss7.lock);
linksets[y].ss7.master = AST_PTHREADT_NULL;
for (i = 0; i < SIG_SS7_NUM_DCHANS; i++)
linksets[y].ss7.fds[i] = -1;
sig_ss7_init_linkset(&linksets[y].ss7);
}
ss7_set_error(dahdi_ss7_error);
ss7_set_message(dahdi_ss7_message);
......
......@@ -1609,6 +1609,28 @@ struct sig_ss7_chan *sig_ss7_chan_new(void *pvt_data, struct sig_ss7_callback *c
return pvt;
}
/*!
* \brief Initialize the SS7 linkset control.
* \since 1.8
*
* \param ss7 sig_ss7 SS7 control structure.
*
* \return Nothing
*/
void sig_ss7_init_linkset(struct sig_ss7_linkset *ss7)
{
int idx;
memset(ss7, 0, sizeof(*ss7));
ast_mutex_init(&ss7->lock);
ss7->master = AST_PTHREADT_NULL;
for (idx = 0; idx < ARRAY_LEN(ss7->fds); ++idx) {
ss7->fds[idx] = -1;
}
}
/* ------------------------------------------------------------------- */
#endif /* defined(HAVE_SS7) */
......
......@@ -253,6 +253,7 @@ int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condi
struct ast_channel *sig_ss7_request(struct sig_ss7_chan *p, enum sig_ss7_law law, const struct ast_channel *requestor, int transfercapability);
void sig_ss7_chan_delete(struct sig_ss7_chan *doomed);
struct sig_ss7_chan *sig_ss7_chan_new(void *pvt_data, struct sig_ss7_callback *callback, struct sig_ss7_linkset *ss7);
void sig_ss7_init_linkset(struct sig_ss7_linkset *ss7);
/* ------------------------------------------------------------------- */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment