gsocket: Fix g_socket_get_available_bytes() on Windows and OS X
authorDan Winship <danw@gnome.org>
Sat, 24 Aug 2013 17:55:06 +0000 (13:55 -0400)
committerDan Winship <danw@gnome.org>
Sat, 31 Aug 2013 15:40:44 +0000 (11:40 -0400)
commit9fd0927e5888458c9b1061f3cdf3a1aaa4924e36
tree0b5cf05976bdc59ae819f3fb8ae5a9a99ffb1166
parent8d62c2495a1c74a51eb9c752b3d2e0f4b93feefc
gsocket: Fix g_socket_get_available_bytes() on Windows and OS X

On Windows and OS X, FIONREAD on a UDP socket gets the total number of
bytes available, not the number of bytes available in the next packet,
which is the more useful number (and how the function always behaved
on Linux).

On OS X, fix this by using SO_NREAD. On Windows, fix this by doing a
MSG_PEEK recv() into a giant buffer, since there is apparently no
other way to get the information.

https://bugzilla.gnome.org/show_bug.cgi?id=686786
gio/gsocket.c