Merged revisions 70341 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r70341 | crichter | 2007-06-20 17:29:09 +0200 (Mi, 20 Jun 2007) | 1 line

fixed a bug that was introduced by copy and paste in the last commit ..bchannels weren't cleaned properly.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@71214 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Christian Richter
2007-06-22 22:44:42 +00:00
parent 895849c2cb
commit d0bc56b953
3 changed files with 30 additions and 13 deletions

View File

@@ -424,12 +424,19 @@ static void dump_chan_list(struct misdn_stack *stack)
int i;
for (i=0; i <= stack->b_num; i++) {
cb_log(6, stack->port, "Idx:%d stack->cchan:%d Chan:%d\n",i,stack->channels[i], i+1);
cb_log(6, stack->port, "Idx:%d stack->cchan:%d in_use:%d Chan:%d\n",i,stack->channels[i], stack->bc[i].in_use, i+1);
}
}
void misdn_dump_chanlist()
{
struct misdn_stack *stack=get_misdn_stack();
for ( ; stack; stack=stack->next) {
dump_chan_list(stack);
}
}
static int find_free_chan_in_stack(struct misdn_stack *stack, struct misdn_bchannel *bc, int channel, int dec)
{
@@ -669,7 +676,6 @@ static int clean_up_bc(struct misdn_bchannel *bc)
mISDN_write_frame(stack->midev, buff, bc->layer_id|FLG_MSG_TARGET|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
bc->b_stid = 0;
bc->in_use = 0;
bc_state_change(bc, BCHAN_CLEANED);
return ret;
@@ -687,6 +693,7 @@ static void clear_l3(struct misdn_stack *stack)
empty_chan_in_stack(stack,i+1);
empty_bc(&stack->bc[i]);
clean_up_bc(&stack->bc[i]);
stack->bc[i].in_use = 0;
}
}
@@ -1605,7 +1612,8 @@ static int handle_cr ( struct misdn_stack *stack, iframe_t *frm)
clean_up_bc(bc);
if (channel>0)
empty_chan_in_stack(stack,bc->channel);
empty_chan_in_stack(stack,channel);
bc->in_use=0;
dump_chan_list(stack);
@@ -1639,11 +1647,12 @@ void misdn_lib_release(struct misdn_bchannel *bc)
return;
}
if (bc->channel>0) {
if (bc->channel>0)
empty_chan_in_stack(stack,bc->channel);
}
empty_bc(bc);
clean_up_bc(bc);
bc->in_use=0;
}
@@ -2061,7 +2070,7 @@ handle_event_nt(void *dat, void *arg)
break;
case EVENT_RELEASE:
case EVENT_RELEASE_COMPLETE:
{
{
int channel=bc->channel;
int tmpcause=bc->cause;
empty_bc(bc);
@@ -2069,7 +2078,8 @@ handle_event_nt(void *dat, void *arg)
clean_up_bc(bc);
if (channel>0)
empty_chan_in_stack(stack, bc->channel);
empty_chan_in_stack(stack,channel);
bc->in_use=0;
}
break;
@@ -2640,8 +2650,6 @@ handle_frm_bc:
bc->in_use=0;
cb_log(0, stack->port, "GOT IGNORE SETUP\n");
break;
case RESPONSE_OK:
cb_log(4, stack->port, "GOT SETUP OK\n");
@@ -2669,8 +2677,9 @@ handle_frm_bc:
set_chan_in_stack(stack,bc->channel);
} else {
if (channel>0)
empty_chan_in_stack(stack,bc->channel);
empty_chan_in_stack(stack,channel);
}
bc->in_use=0;
}
cb_log(5, stack->port, "Freeing Msg on prim:%x \n",frm->prim);
@@ -3359,7 +3368,9 @@ int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
clean_up_bc(bc);
if (channel>0)
empty_chan_in_stack(stack,bc->channel);
empty_chan_in_stack(stack,channel);
bc->in_use=0;
}
}
@@ -3404,6 +3415,8 @@ int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
if (channel>0)
empty_chan_in_stack(stack,channel);
bc->in_use=0;
}
break;
@@ -3703,9 +3716,11 @@ int misdn_lib_send_restart(int port, int channel)
if (stack->bc[cnt].channel == i) {
empty_bc(&stack->bc[cnt]);
clean_up_bc(&stack->bc[cnt]);
stack->bc[cnt].in_use=0;
}
}
empty_chan_in_stack(stack, i);
}
@@ -4207,7 +4222,8 @@ void manager_clean_bc(struct misdn_bchannel *bc )
if (bc->channel>0)
empty_chan_in_stack(stack, bc->channel);
empty_bc(bc);
bc->in_use=0;
cb_event(EVENT_CLEANUP, bc, NULL);
}