[asterisk-commits] wedhorn: branch wedhorn/skinny-subs r191410 - in /team/wedhorn/skinny-subs: ....

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 30 16:41:58 CDT 2009


Author: wedhorn
Date: Thu Apr 30 16:41:55 2009
New Revision: 191410

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191410
Log:
Change _skinny_show_lines (verbose) to not crash when !sub->owner. This is due to the new way of handling subs where at the beginning and end of a call, there may not be an associated chan.

Partial fix for power cycling device in the middle of a call. Still get core dump when old session times out. Will fix later.

Modified:
    team/wedhorn/skinny-subs/   (props changed)
    team/wedhorn/skinny-subs/channels/chan_skinny.c

Propchange: team/wedhorn/skinny-subs/
------------------------------------------------------------------------------
    automerge-email = voip at facts.com.au

Modified: team/wedhorn/skinny-subs/channels/chan_skinny.c
URL: http://svn.digium.com/svn-view/asterisk/team/wedhorn/skinny-subs/channels/chan_skinny.c?view=diff&rev=191410&r1=191409&r2=191410
==============================================================================
--- team/wedhorn/skinny-subs/channels/chan_skinny.c (original)
+++ team/wedhorn/skinny-subs/channels/chan_skinny.c Thu Apr 30 16:41:55 2009
@@ -1437,6 +1437,8 @@
 static struct skinny_subchannel *set_sub_state(struct skinny_subchannel *sub, int state);
 //static struct skinny_subchannel *set_workingsub_state(struct skinny_device *d, int state);
 static void destroy_sub(struct skinny_subchannel *sub);
+static void destroy_session(struct skinnysession *s);
+static int skinny_unregister(struct skinny_req *req, struct skinnysession *s);
 
 static const struct ast_channel_tech skinny_tech = {
 	.type = "Skinny",
@@ -2404,6 +2406,10 @@
 	AST_LIST_TRAVERSE(&devices, d, list){
 		if (!strcasecmp(req->data.reg.name, d->id)
 				&& ast_apply_ha(d->ha, &(s->sin))) {
+			if (d->session) {
+				skinny_unregister(NULL, d->session);
+				destroy_session(d->session);
+			}
 			s->device = d;
 			d->type = letohl(req->data.reg.type);
 			if (ast_strlen_zero(d->version_id)) {
@@ -4163,8 +4169,8 @@
 				AST_LIST_TRAVERSE(&l->subs, sub, llist) {
 					ast_cli(fd, "  %s> %s to %s\n",
 						(sub == l->activesub?"Active  ":"Inactive"),
-						sub->owner->name,
-						(ast_bridged_channel(sub->owner)?ast_bridged_channel(sub->owner)->name:"")
+						sub->owner?sub->owner->name:sub->label,
+						((sub->owner && ast_bridged_channel(sub->owner))?ast_bridged_channel(sub->owner)->name:"")
 					);
 				}
 			}
@@ -4183,8 +4189,8 @@
 				l->instance,
 				l->label);
 		}
-		AST_LIST_UNLOCK(&lines);
-	}
+	}
+	AST_LIST_UNLOCK(&lines);
 
 	if (total) {
 		*total = total_lines;
@@ -6593,19 +6599,21 @@
 {
 	struct skinnysession *cur;
 	AST_LIST_LOCK(&sessions);
-	 AST_LIST_TRAVERSE_SAFE_BEGIN(&sessions, cur, list) {
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&sessions, cur, list) {
 		if (cur == s) {
 			AST_LIST_REMOVE_CURRENT(list);
 			if (s->fd > -1) 
 				close(s->fd);
 			
 			ast_free(s);
-		} else {
-			ast_log(LOG_WARNING, "Trying to delete nonexistent session %p?\n", s);
+			break;
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END
 	AST_LIST_UNLOCK(&sessions);
+	if (!cur) {
+		ast_log(LOG_WARNING, "Tried to delete nonexistent session %p?\n", s);
+	}
 }
 
 static int get_input(struct skinnysession *s)




More information about the asterisk-commits mailing list