path: root/openbsc
diff options
authorAndreas Eversberg <jolly@eversberg.eu>2012-03-16 08:14:23 +0100
committerIvan Kluchnikov <kluchnikovi@gmail.com>2014-05-06 17:21:49 +0400
commit0105a6b3408c67237726f500b807ae046995551d (patch)
tree503fcdf2146cf86dfa45e9ec78858e419b9abcc7 /openbsc
parent3cb7a632ccb26fd2688fe306aeb3b4d60f49665c (diff)
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.
Diffstat (limited to 'openbsc')
1 files changed, 10 insertions, 3 deletions
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index ad3dbb648..52abad0ce 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -497,9 +497,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) {
- rss->bfd.when &= ~BSC_FD_READ;
- return rc;
+ if (rc == 0)
+ goto out_free;
+ if (rc < 0) {
+ /* Ignore "connection refused". this happens, If we open the
+ * socket faster than the remove side. */
+ if (errno == ECONNREFUSED)
+ goto out_free;
+ DEBUGPC(DLMUX, "Read of RTP socket (%p) failed (errno %d, "
+ "%s)\n", rs, errno, strerror(errno));
+ goto out_free;
msgb_put(msg, rc);