]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 70341 via svnmerge from
authorChristian Richter <christian.richter@beronet.com>
Fri, 22 Jun 2007 22:44:42 +0000 (22:44 +0000)
committerChristian Richter <christian.richter@beronet.com>
Fri, 22 Jun 2007 22:44:42 +0000 (22:44 +0000)
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

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

index 85afca84e3f73bb73d8dafa91b5b253398c8db93..9c957afe0315025bfc1252ade190546bef06408d 100644 (file)
@@ -1140,7 +1140,7 @@ static int misdn_show_cls (int fd, int argc, char *argv[])
                }
        }
   
-  
+       misdn_dump_chanlist();
        return 0;
 }
 
index 92c594aec5aa6a96513ff3022046e35aeab76903..ba7fe145aca3824f756b7f68bfd5d6981915b5db 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)
 {
@@ -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); 
 }
 
index 4eab0d5cdb762fea8cf5f48878120720f1bc2c9f..bb5b3063a8657369815ab6c2a5fce1bc2b9ef5d3 100644 (file)
@@ -475,5 +475,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