aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libtrau
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-03-16 08:14:23 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-03-28 17:56:16 +0100
commitcf7557a7e756af54350fb9bcf1a19429848a17de (patch)
treea0ba776f2db8c598197caace85aa5f65b1c598e6 /openbsc/src/libtrau
parent37b5ce56a0650eeb8a3c6b788d1c9ba16139b313 (diff)
rtp: Fixed problem of mute audio on some calls
When reading from RTP socket, the first read() may fail right after connecting to remote socket. Subsequent read() will work as it should. If the remote socket does not open fast enough, the transmitted RTP payload can cause an ICMP (connection refused) packet reply. This causes the read to fail with errno=111. In all other error cases, the errno is logged at debug level. In all error cases, reading is not disabled. Conflicts: openbsc/src/libtrau/rtp_proxy.c [hfreyther: Fix typo, stop reading in all cases but ECONNREFUSED]
Diffstat (limited to 'openbsc/src/libtrau')
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index be00dde3b..8c982c976 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -392,7 +392,16 @@ static int rtp_socket_read(struct rtp_socket *rs, struct rtp_sub_socket *rss)
return -ENOMEM;
rc = read(rss->bfd.fd, msg->data, RTP_ALLOC_SIZE);
- if (rc <= 0) {
+ if (rc == 0) {
+ rss->bfd.when &= ~BSC_FD_READ;
+ goto out_free;
+ } else if (rc < 0) {
+ /* Ignore "connection refused". this happens, If we open the
+ * socket faster than the remote side. */
+ if (errno == ECONNREFUSED)
+ goto out_free;
+ DEBUGPC(DLMUX, "Read of RTP socket (%p) failed (errno %d, "
+ "%s)\n", rs, errno, strerror(errno));
rss->bfd.when &= ~BSC_FD_READ;
goto out_free;
}