[asterisk-commits] kpfleming: branch 1.4 r68313 - /branches/1.4/channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 7 15:14:35 MST 2007


Author: kpfleming
Date: Thu Jun  7 17:14:35 2007
New Revision: 68313

URL: http://svn.digium.com/view/asterisk?view=rev&rev=68313
Log:
some improvements to the IAX2 full frame dropping logic recently added:

- use inaddrcmp(), since we have it
- output the type of frame and subclass being dropped, and the type/subclass that is already being processed (which caused the drop)


Modified:
    branches/1.4/channels/chan_iax2.c

Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=68313&r1=68312&r2=68313
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Thu Jun  7 17:14:35 2007
@@ -703,12 +703,16 @@
 	time_t checktime;
 	ast_mutex_t lock;
 	ast_cond_t cond;
-	unsigned short ffcallno;		/* if this thread is processing a full frame, the
-						   callno for that frame will be here, so we can
-						   avoid dispatching any more full frames for that
-						   callno to other threads */
-	struct sockaddr_in ffsin;		/* remember the peer IP/port number for a full frame
-						   in process */
+	/*! if this thread is processing a full frame,
+	  some information about that frame will be stored
+	  here, so we can avoid dispatching any more full
+	  frames for that callno to other threads */
+	struct {
+		unsigned short callno;
+		struct sockaddr_in sin;
+		unsigned char type;
+		unsigned char csub;
+	} ffinfo;
 };
 
 /* Thread lists */
@@ -888,10 +892,8 @@
 
 	/* this thread is not processing a full frame (since it is idle),
 	   so ensure that the field for the full frame call number is empty */
-	if (thread) {
-		thread->ffcallno = 0;
-		memset(&thread->ffsin, 0, sizeof(thread->ffsin));
-	}
+	if (thread)
+		memset(&thread->ffinfo, 0, sizeof(thread->ffinfo));
 
 	return thread;
 }
@@ -6309,22 +6311,24 @@
 		
 		AST_LIST_LOCK(&active_list);
 		AST_LIST_TRAVERSE(&active_list, cur, list) {
-			if ((cur->ffcallno == ntohs(fh->scallno)) &&
-			    !memcmp(&cur->ffsin, &thread->iosin, sizeof(cur->ffsin)))
+			if ((cur->ffinfo.callno == ntohs(fh->scallno)) &&
+			    !inaddrcmp(&cur->ffinfo.sin, &thread->iosin))
 				break;
 		}
 		AST_LIST_UNLOCK(&active_list);
 		if (cur) {
 			/* we found another thread processing a full frame for this call,
 			   so we can't accept this frame */
-			ast_log(LOG_WARNING, "Dropping full frame from %s (callno %d) received too rapidly\n",
-				ast_inet_ntoa(thread->iosin.sin_addr), cur->ffcallno);
+			ast_log(LOG_WARNING, "Dropping frame from %s (callno %d) of type %d (subclass %d) due to frame of type %d (subclass %d) already in process\n",
+				ast_inet_ntoa(thread->iosin.sin_addr), cur->ffinfo.callno,
+				fh->type, uncompress_subclass(fh->csub),
+				cur->ffinfo.type, uncompress_subclass(cur->ffinfo.csub));
 			insert_idle_thread(thread);
 			return 1;
 		} else {
 			/* this thread is going to process this frame, so mark it */
-			thread->ffcallno = ntohs(fh->scallno);
-			memcpy(&thread->ffsin, &thread->iosin, sizeof(thread->ffsin));
+			thread->ffinfo.callno = ntohs(fh->scallno);
+			memcpy(&thread->ffinfo.sin, &thread->iosin, sizeof(thread->ffinfo.sin));
 		}
 	}
 	



More information about the asterisk-commits mailing list