[asterisk-commits] crichter: branch 1.4 r72852 - in /branches/1.4: ./ channels/ channels/misdn/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 2 03:41:09 CDT 2007
Author: crichter
Date: Mon Jul 2 03:41:08 2007
New Revision: 72852
URL: http://svn.digium.com/view/asterisk?view=rev&rev=72852
Log:
Merged revisions 72585 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r72585 | crichter | 2007-06-29 15:08:26 +0200 (Fr, 29 Jun 2007) | 1 line
check if the bchannel stack id is already used, if so don't use it a second time. Also added a release_chan lock, so that the same chan_list object cannot be freed twice. chan_misdn does not crash anymore on heavy load with these changes.
........
Modified:
branches/1.4/ (props changed)
branches/1.4/channels/chan_misdn.c
branches/1.4/channels/misdn/isdn_lib.c
Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Modified: branches/1.4/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_misdn.c?view=diff&rev=72852&r1=72851&r2=72852
==============================================================================
--- branches/1.4/channels/chan_misdn.c (original)
+++ branches/1.4/channels/chan_misdn.c Mon Jul 2 03:41:08 2007
@@ -109,6 +109,10 @@
of data. */
int misdn_jb_empty(struct misdn_jb *jb, char *data, int len);
+
+/* BEGIN: chan_misdn.h */
+
+ast_mutex_t release_lock;
enum misdn_chan_state {
MISDN_NOTHING=0, /*!< at beginning */
@@ -2424,11 +2428,13 @@
/* between request and call */
ast_log(LOG_DEBUG, "State Reserved (or nothing) => chanIsAvail\n");
MISDN_ASTERISK_TECH_PVT(ast)=NULL;
-
+
+ ast_mutex_lock(&release_lock);
cl_dequeue_chan(&cl_te, p);
close(p->pipe[0]);
close(p->pipe[1]);
free(p);
+ ast_mutex_unlock(&release_lock);
if (bc)
misdn_lib_release(bc);
@@ -3516,10 +3522,13 @@
/** Isdn asks us to release channel, pendant to misdn_hangup **/
static void release_chan(struct misdn_bchannel *bc) {
struct ast_channel *ast=NULL;
+
+ ast_mutex_lock(&release_lock);
{
struct chan_list *ch=find_chan_by_bc(cl_te, bc);
if (!ch) {
chan_misdn_log(1, bc->port, "release_chan: Ch not found!\n");
+ ast_mutex_unlock(&release_lock);
return;
}
@@ -3578,6 +3587,8 @@
/* chan is already cleaned, so exiting */
}
}
+
+ ast_mutex_unlock(&release_lock);
}
/*** release end **/
@@ -4917,6 +4928,7 @@
}
ast_mutex_init(&cl_te_lock);
+ ast_mutex_init(&release_lock);
misdn_cfg_update_ptp();
misdn_cfg_get_ports_string(ports);
Modified: branches/1.4/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/misdn/isdn_lib.c?view=diff&rev=72852&r1=72851&r2=72852
==============================================================================
--- branches/1.4/channels/misdn/isdn_lib.c (original)
+++ branches/1.4/channels/misdn/isdn_lib.c Mon Jul 2 03:41:08 2007
@@ -41,7 +41,7 @@
return -1;
}
-void make_dummy(struct misdn_bchannel *dummybc, int port, int l3id, int nt, int channel)
+static void make_dummy(struct misdn_bchannel *dummybc, int port, int l3id, int nt, int channel)
{
memset (dummybc,0,sizeof(struct misdn_bchannel));
dummybc->port=port;
@@ -964,7 +964,7 @@
int channel=bc->channel-1-(bc->channel>16);
int b_stid=stack->b_stids[channel>=0?channel:0];
-
+
switch (bc->bc_state) {
case BCHAN_CLEANED:
break;
@@ -974,6 +974,15 @@
}
cb_log(5, stack->port, "$$$ Setting up bc with stid :%x\n", b_stid);
+
+ /*check if the b_stid is alread initialized*/
+ int i;
+ for (i=0; i <= stack->b_num; i++) {
+ if (stack->bc[i].b_stid == b_stid) {
+ cb_log(0, bc->port, "setup_bc: b_stid:%x already in use !!!\n", b_stid);
+ return -1;
+ }
+ }
if (b_stid <= 0) {
cb_log(0, stack->port," -- Stid <=0 at the moment in channel:%d\n",channel);
More information about the asterisk-commits
mailing list