From: Youness Alaoui Date: Thu, 1 May 2008 10:52:11 +0000 (+0000) Subject: gst/udp/gstudpsrc.c: Don't error out if we get an ICMP destination-unreachable messag... X-Git-Tag: RELEASE-0_10_9~212 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=751f2bb3646f2beff3698c9f09900dbd0ea08abb;p=platform%2Fupstream%2Fgst-plugins-good.git gst/udp/gstudpsrc.c: Don't error out if we get an ICMP destination-unreachable message when trying to read packets on... Original commit message from CVS: Patch by: Youness Alaoui * gst/udp/gstudpsrc.c: (gst_udpsrc_create): Don't error out if we get an ICMP destination-unreachable message when trying to read packets on win32 (#529454). --- diff --git a/ChangeLog b/ChangeLog index 9902fda..b8319ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-01 Tim-Philipp Müller + + Patch by: Youness Alaoui + + * gst/udp/gstudpsrc.c: (gst_udpsrc_create): + Don't error out if we get an ICMP destination-unreachable + message when trying to read packets on win32 (#529454). + 2008-04-30 Tim-Philipp Müller * configure.ac: diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index 2c0802a..be150f3 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -434,8 +434,21 @@ no_select: ret = recvfrom (udpsrc->sock.fd, pktdata, pktsize, 0, (struct sockaddr *) &tmpaddr, &len); if (ret < 0) { +#ifdef G_OS_WIN32 + /* WSAECONNRESET for a UDP socket means that a packet sent with udpsink + * generated a "port unreachable" ICMP response. We ignore that and try + * again. */ + if (WSAGetLastError () == WSAECONNRESET) { + g_free (pktdata); + pktdata = NULL; + goto retry; + } + if (WSAGetLastError () != WSAEINTR) + goto receive_error; +#else if (errno != EAGAIN && errno != EINTR) goto receive_error; +#endif } else break; } @@ -487,8 +500,13 @@ ioctl_failed: receive_error: { g_free (pktdata); +#ifdef G_OS_WIN32 + GST_ELEMENT_ERROR (udpsrc, RESOURCE, READ, (NULL), + ("receive error %d (WSA error: %d)", ret, WSAGetLastError ())); +#else GST_ELEMENT_ERROR (udpsrc, RESOURCE, READ, (NULL), ("receive error %d: %s (%d)", ret, g_strerror (errno), errno)); +#endif return GST_FLOW_ERROR; } skip_error: