[Pkg-voip-commits] [janus] 260/282: Be a bit more tolerant of ICMP errors on RTP in SIP, SIPre and NoSIP plugins (fixes #1095)
Jonas Smedegaard
dr at jones.dk
Wed Dec 20 21:53:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.2.6-1
in repository janus.
commit 7a1f8e5db8df40e7d6be2a01d8aad0ca0508b7ae
Author: Lorenzo Miniero <lminiero at gmail.com>
Date: Wed Dec 13 19:06:22 2017 +0100
Be a bit more tolerant of ICMP errors on RTP in SIP, SIPre and NoSIP plugins (fixes #1095)
---
plugins/janus_nosip.c | 11 +++++++----
plugins/janus_sip.c | 19 ++++++++++---------
plugins/janus_sipre.c | 13 +++++++++----
3 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/plugins/janus_nosip.c b/plugins/janus_nosip.c
index 3a92b32..7121d13 100644
--- a/plugins/janus_nosip.c
+++ b/plugins/janus_nosip.c
@@ -1792,7 +1792,7 @@ static void *janus_nosip_relay_thread(void *data) {
/* File descriptors */
socklen_t addrlen;
struct sockaddr_in remote;
- int resfd = 0, bytes = 0;
+ int resfd = 0, bytes = 0, pollerrs = 0;
struct pollfd fds[5];
int pipe_fd = session->media.pipefd[0];
char buffer[1500];
@@ -1889,10 +1889,12 @@ static void *janus_nosip_relay_thread(void *data) {
close(session->media.video_rtcp_fd);
session->media.video_rtcp_fd = -1;
}
- /* FIXME Should we do the same with the RTP sockets as well? We may risk overreacting, there... */
- continue;
}
- JANUS_LOG(LOG_ERR, "[NoSIP-%p] Error polling %d (socket #%d): %s...\n", session,
+ /* FIXME Should we be more tolerant of ICMP errors on RTP sockets as well? */
+ pollerrs++;
+ if(pollerrs < 100)
+ continue;
+ JANUS_LOG(LOG_ERR, "[NoSIP-%p] Too many errors polling %d (socket #%d): %s...\n", session,
fds[i].fd, i, fds[i].revents & POLLERR ? "POLLERR" : "POLLHUP");
JANUS_LOG(LOG_ERR, "[NoSIP-%p] -- %d (%s)\n", session, error, strerror(error));
/* Can we assume it's pretty much over, after a POLLERR? */
@@ -1919,6 +1921,7 @@ static void *janus_nosip_relay_thread(void *data) {
gboolean rtcp = fds[i].fd == session->media.audio_rtcp_fd || fds[i].fd == session->media.video_rtcp_fd;
if(!rtcp) {
/* Audio or Video RTP */
+ pollerrs = 0;
rtp_header *header = (rtp_header *)buffer;
if((video && session->media.video_ssrc_peer != ntohl(header->ssrc)) ||
(!video && session->media.audio_ssrc_peer != ntohl(header->ssrc))) {
diff --git a/plugins/janus_sip.c b/plugins/janus_sip.c
index dfb730a..785774b 100644
--- a/plugins/janus_sip.c
+++ b/plugins/janus_sip.c
@@ -3776,7 +3776,7 @@ static void *janus_sip_relay_thread(void *data) {
/* File descriptors */
socklen_t addrlen;
struct sockaddr_in remote;
- int resfd = 0, bytes = 0;
+ int resfd = 0, bytes = 0, pollerrs = 0;
struct pollfd fds[5];
int pipe_fd = session->media.pipefd[0];
char buffer[1500];
@@ -3879,9 +3879,12 @@ static void *janus_sip_relay_thread(void *data) {
session->media.video_rtcp_fd = -1;
continue;
}
- /* FIXME Should we be more tolerant of ICMP errors on RTP sockets as well? */
}
- JANUS_LOG(LOG_ERR, "[SIP-%s] Error polling %d (socket #%d): %s...\n", session->account.username,
+ /* FIXME Should we be more tolerant of ICMP errors on RTP sockets as well? */
+ pollerrs++;
+ if(pollerrs < 100)
+ continue;
+ JANUS_LOG(LOG_ERR, "[SIP-%s] Too many errors polling %d (socket #%d): %s...\n", session->account.username,
fds[i].fd, i, fds[i].revents & POLLERR ? "POLLERR" : "POLLHUP");
JANUS_LOG(LOG_ERR, "[SIP-%s] -- %d (%s)\n", session->account.username, error, strerror(error));
goon = FALSE; /* Can we assume it's pretty much over, after a POLLERR? */
@@ -3909,6 +3912,7 @@ static void *janus_sip_relay_thread(void *data) {
/* Failed to read? */
continue;
}
+ pollerrs = 0;
janus_rtp_header *header = (janus_rtp_header *)buffer;
if(session->media.audio_ssrc_peer != ntohl(header->ssrc)) {
session->media.audio_ssrc_peer = ntohl(header->ssrc);
@@ -3950,7 +3954,7 @@ static void *janus_sip_relay_thread(void *data) {
/* Failed to read? */
continue;
}
- //~ JANUS_LOG(LOG_VERB, "************************\nGot %d bytes on the audio RTCP channel...\n", bytes);
+ pollerrs = 0;
/* Is this SRTCP? */
if(session->media.has_srtp_remote) {
int buflen = bytes;
@@ -3973,10 +3977,7 @@ static void *janus_sip_relay_thread(void *data) {
/* Failed to read? */
continue;
}
- //~ JANUS_LOG(LOG_VERB, "************************\nGot %d bytes on the video RTP channel...\n", bytes);
- //~ janus_rtp_header_t *rtp = (janus_rtp_header_t *)buffer;
- //~ JANUS_LOG(LOG_VERB, " ... parsed RTP packet (ssrc=%u, pt=%u, seq=%u, ts=%u)...\n",
- //~ ntohl(rtp->ssrc), rtp->type, ntohs(rtp->seq_number), ntohl(rtp->timestamp));
+ pollerrs = 0;
janus_rtp_header *header = (janus_rtp_header *)buffer;
if(session->media.video_ssrc_peer != ntohl(header->ssrc)) {
session->media.video_ssrc_peer = ntohl(header->ssrc);
@@ -4018,7 +4019,7 @@ static void *janus_sip_relay_thread(void *data) {
/* Failed to read? */
continue;
}
- //~ JANUS_LOG(LOG_VERB, "************************\nGot %d bytes on the video RTCP channel...\n", bytes);
+ pollerrs = 0;
/* Is this SRTCP? */
if(session->media.has_srtp_remote) {
int buflen = bytes;
diff --git a/plugins/janus_sipre.c b/plugins/janus_sipre.c
index 9c6c5d3..1b5f3f5 100644
--- a/plugins/janus_sipre.c
+++ b/plugins/janus_sipre.c
@@ -2960,7 +2960,7 @@ static void *janus_sipre_relay_thread(void *data) {
/* File descriptors */
socklen_t addrlen;
struct sockaddr_in remote;
- int resfd = 0, bytes = 0;
+ int resfd = 0, bytes = 0, pollerrs = 0;
struct pollfd fds[5];
int pipe_fd = session->media.pipefd[0];
char buffer[1500];
@@ -3054,16 +3054,20 @@ static void *janus_sipre_relay_thread(void *data) {
session->account.username, strerror(error));
close(session->media.audio_rtcp_fd);
session->media.audio_rtcp_fd = -1;
+ continue;
} else if(fds[i].fd == session->media.video_rtcp_fd) {
JANUS_LOG(LOG_WARN, "[SIPre-%s] Got a '%s' on the video RTCP socket, closing it\n",
session->account.username, strerror(error));
close(session->media.video_rtcp_fd);
session->media.video_rtcp_fd = -1;
+ continue;
}
- /* FIXME Should we do the same with the RTP sockets as well? We may risk overreacting, there... */
- continue;
}
- JANUS_LOG(LOG_ERR, "[SIPre-%s] Error polling %d (socket #%d): %s...\n", session->account.username,
+ /* FIXME Should we be more tolerant of ICMP errors on RTP sockets as well? */
+ pollerrs++;
+ if(pollerrs < 100)
+ continue;
+ JANUS_LOG(LOG_ERR, "[SIPre-%s] Too many errors polling %d (socket #%d): %s...\n", session->account.username,
fds[i].fd, i, fds[i].revents & POLLERR ? "POLLERR" : "POLLHUP");
JANUS_LOG(LOG_ERR, "[SIPre-%s] -- %d (%s)\n", session->account.username, error, strerror(error));
/* Can we assume it's pretty much over, after a POLLERR? */
@@ -3095,6 +3099,7 @@ static void *janus_sipre_relay_thread(void *data) {
gboolean rtcp = fds[i].fd == session->media.audio_rtcp_fd || fds[i].fd == session->media.video_rtcp_fd;
if(!rtcp) {
/* Audio or Video RTP */
+ pollerrs = 0;
rtp_header *header = (rtp_header *)buffer;
if((video && session->media.video_ssrc_peer != ntohl(header->ssrc)) ||
(!video && session->media.audio_ssrc_peer != ntohl(header->ssrc))) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/janus.git
More information about the Pkg-voip-commits
mailing list