udpsrc: drop dataless UDP packets
authorJohn Ogness <john.ogness@linutronix.de>
Wed, 21 Dec 2011 12:22:03 +0000 (13:22 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Tue, 27 Dec 2011 01:40:34 +0000 (01:40 +0000)
commit0c4b60f01044e097d30095ceb3b7c65e57126a8f
tree04b2e27ec4281404bc807acc1422744fa7eb03db
parente72b55b6ac84ae5748ea3e462802a96a71b4acca
udpsrc: drop dataless UDP packets

It is allowed to send/receive UDP packets with no data. When such
a packet is available, select() will return with success but
ioctl(FIONREAD) will return 0. But a read() must still occur in
order to clear off the UDP packet from the queue.

This patch will read the dataless packet from the socket. If
select() was woken for other reasons (and FIONREAD returns 0),
this may result in a UDP packet getting accidentally dropped.
But since UDP is not reliable, this is acceptable.

NOTE: This patch fixes a nasty bug where sending a dataless
      UDP packet to a udpsrc instance will cause an infinite
      loop.

https://bugzilla.gnome.org/show_bug.cgi?id=666644

Signed-off-by: John Ogness <john.ogness@linutronix.de>
gst/udp/gstudpsrc.c