diff options
author | Gregory Nietsky <gregory@distrotech.co.za> | 2011-09-22 11:46:35 +0000 |
---|---|---|
committer | Gregory Nietsky <gregory@distrotech.co.za> | 2011-09-22 11:46:35 +0000 |
commit | 8a74aa9ef991ca21d31bc8278f771fa9e0dbdc6d (patch) | |
tree | d55bf99b510d3e7cfb83904637eb8efebc94827c /res/res_srtp.c | |
parent | 308ec93d649bc5dea0faa69f129fabc22b61996e (diff) |
Merged revisions 337542 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10
................
r337542 | irroot | 2011-09-22 13:44:22 +0200 (Thu, 22 Sep 2011) | 14 lines
Merged revisions 337541 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r337541 | irroot | 2011-09-22 13:39:49 +0200 (Thu, 22 Sep 2011) | 8 lines
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.
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_srtp.c')
-rw-r--r-- | res/res_srtp.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/res/res_srtp.c b/res/res_srtp.c index 223b79bbb..fe1ee73ce 100644 --- a/res/res_srtp.c +++ b/res/res_srtp.c @@ -54,6 +54,7 @@ struct ast_srtp { srtp_t session; const struct ast_srtp_cb *cb; void *data; + int warned; unsigned char buf[8192 + AST_FRIENDLY_OFFSET]; }; @@ -179,6 +180,8 @@ static struct ast_srtp *res_srtp_new(void) ast_free(srtp); return NULL; } + + srtp->warned = 1; return srtp; } @@ -382,7 +385,12 @@ static int ast_srtp_unprotect(struct ast_srtp *srtp, void *buf, int *len, int rt } 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; } |