When reading from RTP socket, the first read() may fail right after connecting to remote socket. Subsequent read() will work as it should.
I have not discovered why this read fails, but I don't see any reason why we should stop reading, just because one read() fails at the beginning. --- openbsc/src/libtrau/rtp_proxy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c index 3e6c462..8b19c93 100644 --- a/openbsc/src/libtrau/rtp_proxy.c +++ b/openbsc/src/libtrau/rtp_proxy.c @@ -501,10 +501,8 @@ 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; + if (rc <= 0) return rc; - }
msgb_put(msg, rc);