[svn-commits] russell: branch russell/iax2_frame_queue r77995 - in /team/russell/iax2_frame...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 2 15:41:09 CDT 2007


Author: russell
Date: Thu Aug  2 15:41:08 2007
New Revision: 77995

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77995
Log:
resolve conflict

Modified:
    team/russell/iax2_frame_queue/   (props changed)
    team/russell/iax2_frame_queue/channels/chan_iax2.c
    team/russell/iax2_frame_queue/channels/chan_skinny.c
    team/russell/iax2_frame_queue/main/fskmodem.c

Propchange: team/russell/iax2_frame_queue/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/russell/iax2_frame_queue/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/iax2_frame_queue/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Aug  2 15:41:08 2007
@@ -1,1 +1,1 @@
-/trunk:1-77933
+/trunk:1-77994

Modified: team/russell/iax2_frame_queue/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_frame_queue/channels/chan_iax2.c?view=diff&rev=77995&r1=77994&r2=77995
==============================================================================
--- team/russell/iax2_frame_queue/channels/chan_iax2.c (original)
+++ team/russell/iax2_frame_queue/channels/chan_iax2.c Thu Aug  2 15:41:08 2007
@@ -1014,8 +1014,10 @@
 	AST_LIST_UNLOCK(&idle_list);
 
 	/* If we popped a thread off the idle list, just return it */
-	if (thread)
+	if (thread) {
+		memset(&thread->ffinfo, 0, sizeof(thread->ffinfo));
 		return thread;
+	}
 
 	/* Pop the head of the dynamic list off */
 	AST_LIST_LOCK(&dynamic_list);
@@ -1023,8 +1025,10 @@
 	AST_LIST_UNLOCK(&dynamic_list);
 
 	/* If we popped a thread off the dynamic list, just return it */
-	if (thread)
+	if (thread) {
+		memset(&thread->ffinfo, 0, sizeof(thread->ffinfo));
 		return thread;
+	}
 
 	/* If we can't create a new dynamic thread for any reason, return no thread at all */
 	if (iaxdynamicthreadcount >= iaxmaxthreadcount || !(thread = ast_calloc(1, sizeof(*thread))))
@@ -6268,7 +6272,9 @@
 	AST_LIST_LOCK(&frame_queue[callno]);
 	AST_LIST_TRAVERSE(&frame_queue[callno], f, list) {
 		/* Send a copy immediately */
-		if (iaxs[callno] && ((unsigned char ) (f->oseqno - last) < 128))
+		if ((f->callno == callno) && iaxs[f->callno] &&
+			((unsigned char ) (f->oseqno - last) < 128) &&
+			(f->retries >= 0)) {
 			send_packet(f);
 	}
 	AST_LIST_UNLOCK(&frame_queue[callno]);
@@ -8388,14 +8394,29 @@
 			ts.tv_sec = tv.tv_sec;
 			ts.tv_nsec = tv.tv_usec * 1000;
 			if (ast_cond_timedwait(&thread->cond, &thread->lock, &ts) == ETIMEDOUT) {
-				ast_mutex_unlock(&thread->lock);
+				/* This thread was never put back into the available dynamic
+				 * thread list, so just go away. */
+				if (!put_into_idle) {
+					ast_mutex_unlock(&thread->lock);
+					break;
+				}
 				AST_LIST_LOCK(&dynamic_list);
 				/* Account for the case where this thread is acquired *right* after a timeout */
 				if ((t = AST_LIST_REMOVE(&dynamic_list, thread, list)))
 					ast_atomic_fetchadd_int(&iaxdynamicthreadcount, -1);
 				AST_LIST_UNLOCK(&dynamic_list);
-				if (t)
-					break;		/* exiting the main loop */
+				if (t) {
+					/* This dynamic thread timed out waiting for a task and was
+					 * not acquired immediately after the timeout, 
+					 * so it's time to go away. */
+					ast_mutex_unlock(&thread->lock);
+					break;
+				}
+				/* Someone grabbed our thread *right* after we timed out.
+				 * Wait for them to set us up with something to do and signal
+				 * us to continue. */
+				ast_cond_timedwait(&thread->cond, &thread->lock, &ts);
+				ast_mutex_unlock(&thread->lock);
 			}
 			if (!t)
 				ast_mutex_unlock(&thread->lock);

Modified: team/russell/iax2_frame_queue/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_frame_queue/channels/chan_skinny.c?view=diff&rev=77995&r1=77994&r2=77995
==============================================================================
--- team/russell/iax2_frame_queue/channels/chan_skinny.c (original)
+++ team/russell/iax2_frame_queue/channels/chan_skinny.c Thu Aug  2 15:41:08 2007
@@ -1629,48 +1629,6 @@
 	transmit_response(s, req);
 }
 */
-static void transmit_callstate(struct skinnysession *s, int instance, int state, unsigned callid)
-{
-	struct skinny_req *req;
-
-	if (state == SKINNY_OFFHOOK) {
-		if (!(req = req_alloc(sizeof(struct activate_call_plane_message), ACTIVATE_CALL_PLANE_MESSAGE)))
-			return;
-
-		req->data.activatecallplane.lineInstance = htolel(instance);
-		transmit_response(s, req);
-	} else if (state == SKINNY_ONHOOK) {
-		transmit_speaker_mode(s, SKINNY_SPEAKEROFF);
-
-		if (!(req = req_alloc(sizeof(struct activate_call_plane_message), ACTIVATE_CALL_PLANE_MESSAGE)))
-			return;
-
-		req->data.activatecallplane.lineInstance = htolel(instance);
-		transmit_response(s, req);
-
-		if (!(req = req_alloc(sizeof(struct close_receive_channel_message), CLOSE_RECEIVE_CHANNEL_MESSAGE)))
-			return;
-
-		req->data.closereceivechannel.conferenceId = htolel(callid);
-		req->data.closereceivechannel.partyId = htolel(callid);
-		transmit_response(s, req);
-
-		if (!(req = req_alloc(sizeof(struct stop_media_transmission_message), STOP_MEDIA_TRANSMISSION_MESSAGE)))
-			return;
-
-		req->data.stopmedia.conferenceId = htolel(callid);
-		req->data.stopmedia.passThruPartyId = htolel(callid);
-		transmit_response(s, req);
-	}
-
-	if (!(req = req_alloc(sizeof(struct call_state_message), CALL_STATE_MESSAGE)))
-		return;
-
-	req->data.callstate.callState = htolel(state);
-	req->data.callstate.lineInstance = htolel(instance);
-	req->data.callstate.callReference = htolel(callid);
-	transmit_response(s, req);
-}
 
 static void transmit_callinfo(struct skinnysession *s, const char *fromname, const char *fromnum, const char *toname, const char *tonum, int instance, int callid, int calltype)
 {
@@ -1882,6 +1840,51 @@
 	req->data.dialednumber.callReference = htolel(callid);
 
 	transmit_response(s, req);
+}
+
+static void transmit_callstate(struct skinnysession *s, int instance, int state, unsigned callid)
+{
+	struct skinny_req *req;
+
+	if (state == SKINNY_ONHOOK) {
+		if (!(req = req_alloc(sizeof(struct close_receive_channel_message), CLOSE_RECEIVE_CHANNEL_MESSAGE)))
+			return;
+
+		req->data.closereceivechannel.conferenceId = htolel(callid);
+		req->data.closereceivechannel.partyId = htolel(callid);
+		transmit_response(s, req);
+
+		if (!(req = req_alloc(sizeof(struct stop_media_transmission_message), STOP_MEDIA_TRANSMISSION_MESSAGE)))
+			return;
+
+		req->data.stopmedia.conferenceId = htolel(callid);
+		req->data.stopmedia.passThruPartyId = htolel(callid);
+		transmit_response(s, req);
+
+		transmit_speaker_mode(s, SKINNY_SPEAKEROFF);
+
+		transmit_displaypromptstatus(s, NULL, 0, instance, callid);
+	}
+
+	if (!(req = req_alloc(sizeof(struct call_state_message), CALL_STATE_MESSAGE)))
+		return;
+
+	req->data.callstate.callState = htolel(state);
+	req->data.callstate.lineInstance = htolel(instance);
+	req->data.callstate.callReference = htolel(callid);
+	transmit_response(s, req);
+
+	if (state == SKINNY_ONHOOK) {
+		transmit_selectsoftkeys(s, 0, 0, KEYDEF_ONHOOK);
+	}
+
+	if (state == SKINNY_OFFHOOK || state == SKINNY_ONHOOK) {
+		if (!(req = req_alloc(sizeof(struct activate_call_plane_message), ACTIVATE_CALL_PLANE_MESSAGE)))
+			return;
+
+		req->data.activatecallplane.lineInstance = htolel(instance);
+		transmit_response(s, req);
+	}
 }
 
 static int skinny_extensionstate_cb(char *context, char *exten, int state, void *data)
@@ -2932,6 +2935,11 @@
 	struct skinnysession *s = d->session;
 	char exten[AST_MAX_EXTENSION] = "";
 
+	if (!s) {
+		ast_log(LOG_NOTICE, "Asked to indicate '%s' condition on channel %s, but session does not exist.\n", control2str(ind), ast->name);
+		return -1;
+	}
+
 	ast_copy_string(exten, S_OR(ast->macroexten, ast->exten), sizeof(exten));
 
 	if (skinnydebug)

Modified: team/russell/iax2_frame_queue/main/fskmodem.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_frame_queue/main/fskmodem.c?view=diff&rev=77995&r1=77994&r2=77995
==============================================================================
--- team/russell/iax2_frame_queue/main/fskmodem.c (original)
+++ team/russell/iax2_frame_queue/main/fskmodem.c Thu Aug  2 15:41:08 2007
@@ -225,7 +225,9 @@
 	int i,j,n1,r;
 	int samples = 0;
 	int olen;
-
+	int beginlen=*len;
+	int beginlenx;
+	
 	switch (fskd->state) {
 		/* Pick up where we left off */
 	case STATE_SEARCH_STARTBIT2:
@@ -253,12 +255,13 @@
 		beginning of a start bit in the TDD sceanario. It just looks for sufficient
 		level to maybe, perhaps, guess, maybe that its maybe the beginning of
 		a start bit, perhaps. This whole thing stinks! */
+		beginlenx=beginlen; /* just to avoid unused war warnings */
 		if (demodulator(fskd, &fskd->x1, GET_SAMPLE))
 			return -1;
 		samples++;
 		for (;;) {
 search_startbit2:		   
-			if (!*len) {
+			if (*len <= 0) {
 				fskd->state  =  STATE_SEARCH_STARTBIT2;
 				return 0;
 			}
@@ -278,7 +281,7 @@
 			fskd->state = STATE_SEARCH_STARTBIT3;
 			return 0;
 		}
-		for (; i; i--) {
+		for (; i>0; i--) {
 			if (demodulator(fskd, &fskd->x1, GET_SAMPLE))
 				return(-1); 
 #if 0




More information about the svn-commits mailing list