GNOME Bugzilla – Bug 643074
Incorrect documentation for g_socket_receive() and g_socket_receive_message()
Last modified: 2011-04-09 16:55:12 UTC
The documentation for g_socket_receive() and g_socket_receive_message() state that "If the socket is in blocking mode the call will block until there is some data to receive or there is an error". This implies that a remote peer performing an orderly shutdown (which must cause the calls to unblock()) will be treated as an error by gio, but that is not the case. The implementation of g_socket_receive_with_blocking() and g_socket_receive_message() only treat an error as arising if recv() and (for the posix implementation) recvmsg() respectively return a value < 0. (Possibly the windows implementation of g_socket_receive_message() behaves differently, but I doubt it.) I have tested that, on standard linux distributions, on remote orderly shutdown of the peer these gio functions unblock returning 0 rather than an error. A documentation patch dealing with this will be attached.
Created attachment 181702 [details] Documentation patch
committed a slight variant of this. thanks