[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r337540 - /team/irroot/distrot...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 22 06:37:09 CDT 2011


Author: irroot
Date: Thu Sep 22 06:37:06 2011
New Revision: 337540

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=337540
Log:
Add warned to ast_srtp to prevent errors on each frame from libsrtp

The first 9 frames are not reported as some devices dont use srtp 
from first frame these are suppresed.

the warning is then output only once every 100 frames.


Modified:
    team/irroot/distrotech-customers-1.8/res/res_srtp.c

Modified: team/irroot/distrotech-customers-1.8/res/res_srtp.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/res/res_srtp.c?view=diff&rev=337540&r1=337539&r2=337540
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_srtp.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_srtp.c Thu Sep 22 06:37:06 2011
@@ -54,6 +54,7 @@
 	srtp_t session;
 	const struct ast_srtp_cb *cb;
 	void *data;
+	int warned;
 	unsigned char buf[8192 + AST_FRIENDLY_OFFSET];
 };
 
@@ -179,6 +180,8 @@
 		ast_free(srtp);
 		return NULL;
 	}
+	
+	srtp->warned = 1;
 
 	return srtp;
 }
@@ -382,7 +385,12 @@
 	}
 
 	if (res != err_status_ok && res != err_status_replay_fail ) {
-		ast_log(LOG_WARNING, "SRTP unprotect: %s\n", srtp_errstr(res));
+		if ((srtp->warned >= 10) && !((srtp->warned - 10) % 100)) {
+			ast_log(LOG_WARNING, "SRTP unprotect: %s %d\n", srtp_errstr(res), srtp->warned);
+			srtp->warned = 11;
+		} else {
+			srtp->warned++;
+		}
 		errno = EAGAIN;
 		return -1;
 	}




More information about the asterisk-commits mailing list