From b86d20e45baaaf284aeb4e4d677718fb1364bd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 9 Nov 2012 11:20:27 +0100 Subject: [PATCH] udpsrc: Don't error out if we get an ICMP destination-unreachable message when trying to read packets See bug #529454 and #687782 and commit 751f2bb3646f2beff3698c9f09900dbd0ea08abb --- gst/udp/gstudpsrc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index e4d473fdff..16fd03fdf7 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -451,8 +451,18 @@ no_select: g_socket_receive_from (udpsrc->used_socket, &saddr, (gchar *) info.data, info.size, udpsrc->cancellable, &err); - if (G_UNLIKELY (res < 0)) + if (G_UNLIKELY (res < 0)) { + /* EHOSTUNREACH for a UDP socket means that a packet sent with udpsink + * generated a "port unreachable" ICMP response. We ignore that and try + * again. */ + if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE)) { + gst_buffer_unmap (outbuf, &info); + gst_buffer_unref (outbuf); + outbuf = NULL; + goto retry; + } goto receive_error; + } /* patch offset and size when stripping off the headers */ if (G_UNLIKELY (udpsrc->skip_first_bytes != 0)) {