If all members of GSocketFamily are supported on the platform, then
all of its values will be positive, and so the enum might become
unsigned, in which case testing for "family < 0" might cause warnings.
But we want to return an error if family == 0 (aka
G_SOCKET_FAMILY_INVALID) anyway, so just tweak the test accordingly.
https://bugzilla.gnome.org/show_bug.cgi?id=674592
This is needed because glib-mkenums doesn't handle #ifdef values in
enums, and so it needs to have all values always defined in the enum.
When not available, define the missing values to a negative value.
Unix and Windows gio GSocket behaves differently when the socket is
closed by the peer. On Unix, the client receives pending data before
receiving HUP. But on Windows, the HUP may come before, resulting in
unreliable and racy code. We should have same behaviour on all
platforms.
According to MSDN documentation: "an application should check for
remaining data upon receipt of FD_CLOSE to avoid any possibility of
losing data."
https://bugzilla.gnome.org/show_bug.cgi?id=669810
Some platforms don't have the source-specific multicast sockopts, and
so would fail to compile. Fix that (and return an error if the caller
tries to use source-specific). Also clarify the docs a bit.
https://bugzilla.gnome.org/show_bug.cgi?id=668468
Apparently IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP are more portable than
IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP. (Windows and Linux have
both, but OS X only has the latter.)
g_socket_receive_with_blocking() and g_socket_send_with_blocking claim
to return -1 in error, their return type is gssize, and yet they
return FALSE if the initial g_return_val_if_fail() call fails.
https://bugzilla.gnome.org/show_bug.cgi?id=667226
Include the hostname (or proxy hostname if it was the connection to
the proxy server that failed) in the GError message when
g_socket_client_connect* fail.
https://bugzilla.gnome.org/show_bug.cgi?id=661266
On Solaris, getsockname() on an unconnected socket gives an addrlen of
0 and doesn't set the sockaddr. So use the SO_DOMAIN sockopt to find
the socket family in that case. (SO_DOMAIN doesn't exist everywhere,
so we can't use it unconditionally. Also, we have to only use it if
getsockname() fails, since SO_DOMAIN returns a bogus value for
accept()ed sockets on both Linux and Solaris...)
The docs for g_socket_set_timeout() claimed that if an async operation
timed out, the GIOCondition passed to the source callback would be
G_IO_IN or G_IO_OUT (thus prompting the caller to call
g_socket_receive/send and get a G_IO_ERROR_TIMED_OUT), but in fact it
ended up being 0, and gio/tests/socket.c was erroneously testing for
that instead of the correct value. Fix this.
socket->priv->connected was only being set if g_socket_connect()
succeeded right away; in the case where it returns G_IO_ERROR_PENDING,
it never got set. Fix that by having g_socket_check_connect_result()
set it on success.
To help cross compilation, don't use glib-genmarshal in our
build. This is easy now that we have g_cclosure_marshal_generic().
In gobject/, add gmarshal.[ch] to git (making the existing entry
points stubs).
In gio/, simply switch to using g_cclosure_marshal_generic().
https://bugzilla.gnome.org/show_bug.cgi?id=652168
glib is trying to move toward using microseconds-in-gint64 as its
universal time format.
No real API breaks here since GTimeSpec is new this unstable release
series.
Otherwise, attempting to create a GSocketConnection from the socket
will likely return the wrong type, since the protocol won't match any
of the registered subtypes.
Also add the start of a GSocket test program (from davidz).
https://bugzilla.gnome.org/show_bug.cgi?id=627171
This way, if g_socket_connect() is called with a GProxyAddress,
g_socket_get_remote_address() will later return that same address.
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
This patch fixes this problem
Syscall param socketcall.sendmsg(msg.msg_control) points to uninitialised byte(s)
at 0x3D5B00EA60: __sendmsg_nocancel (syscall-template.S:82)
by 0x53F9790: g_socket_send_message (gsocket.c:2918)
by 0x540FDD0: g_unix_connection_send_credentials (gunixconnection.c:351)
by 0x542B93F: _g_dbus_auth_run_client (gdbusauth.c:618)
by 0x5438001: initable_init (gdbusconnection.c:2191)
by 0x53E09CC: g_initable_init (ginitable.c:105)
by 0x543F6E9: g_bus_get_sync (gdbusconnection.c:6091)
by 0x402C7E: test_connection_life_cycle (gdbus-connection.c:126)
by 0x4C7CABB: test_case_run (gtestutils.c:1174)
by 0x4C7CD84: g_test_run_suite_internal (gtestutils.c:1223)
by 0x4C7CE49: g_test_run_suite_internal (gtestutils.c:1233)
by 0x4C7CE49: g_test_run_suite_internal (gtestutils.c:1233)
Address 0x7fefff9fc is on thread 1's stack
Signed-off-by: David Zeuthen <davidz@redhat.com>
Previously if a GSocketConnection had a blocking GSocket, it would
sometimes block during asynchonous I/O, and if it had a non-blocking
socket, it would sometimes return G_IO_ERROR_WOULD_BLOCK from
synchronous I/O. This fixes the connection to not depend on the socket
state.
https://bugzilla.gnome.org/show_bug.cgi?id=616458