Merged revisions 71214 via svnmerge from
authorChristian Richter <christian.richter@beronet.com>
Mon, 25 Jun 2007 09:46:18 +0000 (09:46 +0000)
committerChristian Richter <christian.richter@beronet.com>
Mon, 25 Jun 2007 09:46:18 +0000 (09:46 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r71214 | crichter | 2007-06-23 00:44:42 +0200 (Sa, 23 Jun 2007) | 9 lines

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/trunk@71500 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_misdn.c
channels/misdn/isdn_lib.c
channels/misdn/isdn_lib.h

index 89cbf67..fc1309a 100644 (file)
@@ -1154,7 +1154,7 @@ static int misdn_show_cls(int fd, int argc, char *argv[])
                }
        }
 
-
+       misdn_dump_chanlist();
        return 0;
 }
 
index 078c6b7..4c7c91b 100644 (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)
 {
@@ -671,7 +678,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;
@@ -689,6 +695,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;
                }
                
        } 
@@ -1607,7 +1614,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);
 
@@ -1641,11 +1649,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);
@@ -3356,7 +3365,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;   
                }
                
        }
@@ -3401,6 +3412,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;
     
@@ -3700,9 +3713,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);
+
                        
        }
 
@@ -4205,7 +4220,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); 
 }
 
index 0b6dcbb..88d287a 100644 (file)
@@ -476,5 +476,6 @@ void misdn_lib_reinit_nt_stack(int port);
 char *bc_state2str(enum bchannel_state state);
 void bc_state_change(struct misdn_bchannel *bc, enum bchannel_state state);
 
+void misdn_dump_chanlist(void);
 
 #endif