[asterisk-commits] russell: branch russell/debug_threads_1.4 r77954 - in /team/russell/debug_thr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 2 14:48:10 CDT 2007


Author: russell
Date: Thu Aug  2 14:48:10 2007
New Revision: 77954

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77954
Log:
get up to date

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

Propchange: team/russell/debug_threads_1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/russell/debug_threads_1.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Aug  2 14:48:10 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-77895
+/branches/1.4:1-77952

Modified: team/russell/debug_threads_1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/debug_threads_1.4/channels/chan_iax2.c?view=diff&rev=77954&r1=77953&r2=77954
==============================================================================
--- team/russell/debug_threads_1.4/channels/chan_iax2.c (original)
+++ team/russell/debug_threads_1.4/channels/chan_iax2.c Thu Aug  2 14:48:10 2007
@@ -5943,7 +5943,8 @@
 	AST_LIST_TRAVERSE(&iaxq.queue, f, list) {
 		/* Send a copy immediately */
 		if ((f->callno == callno) && iaxs[f->callno] &&
-			((unsigned char ) (f->oseqno - last) < 128)) {
+			((unsigned char ) (f->oseqno - last) < 128) &&
+			(f->retries >= 0)) {
 			send_packet(f);
 		}
 	}
@@ -7873,14 +7874,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)))
 					iaxdynamicthreadcount--;
 				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/debug_threads_1.4/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/russell/debug_threads_1.4/channels/chan_skinny.c?view=diff&rev=77954&r1=77953&r2=77954
==============================================================================
--- team/russell/debug_threads_1.4/channels/chan_skinny.c (original)
+++ team/russell/debug_threads_1.4/channels/chan_skinny.c Thu Aug  2 14:48:10 2007
@@ -1489,48 +1489,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)
 {
@@ -1742,6 +1700,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);
+	}
 }
 
 /*

Modified: team/russell/debug_threads_1.4/main/fskmodem.c
URL: http://svn.digium.com/view/asterisk/team/russell/debug_threads_1.4/main/fskmodem.c?view=diff&rev=77954&r1=77953&r2=77954
==============================================================================
--- team/russell/debug_threads_1.4/main/fskmodem.c (original)
+++ team/russell/debug_threads_1.4/main/fskmodem.c Thu Aug  2 14:48:10 2007
@@ -188,6 +188,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:
@@ -215,12 +218,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 (demodulador(fskd,&fskd->x1,GET_SAMPLE)) return(-1);
 		samples++;
 		for(;;)
 		   {
 search_startbit2:		   
-			if (!*len) {
+			if (*len <= 0) {
 				fskd->state = STATE_SEARCH_STARTBIT2;
 				return 0;
 			}
@@ -238,7 +242,7 @@
 			fskd->state = STATE_SEARCH_STARTBIT3;
 			return 0;
 		}
-		for(;i;i--) { if (demodulador(fskd,&fskd->x1,GET_SAMPLE)) return(-1); 
+		for(;i>0;i--) { if (demodulador(fskd,&fskd->x1,GET_SAMPLE)) return(-1); 
 #if 0
 			printf("x1 = %5.5f ", fskd->x1);
 #endif			




More information about the asterisk-commits mailing list