Always do async vs sync correctly in GSocketConnection streams

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
This commit is contained in:
Dan Winship
2010-06-24 13:09:14 -04:00
parent 17fea2f749
commit 547311bfd8
6 changed files with 101 additions and 18 deletions

View File

@@ -176,6 +176,19 @@ gboolean g_socket_speaks_ipv4 (GSocket
GCredentials *g_socket_get_credentials (GSocket *socket,
GError **error);
gssize g_socket_receive_with_blocking (GSocket *socket,
gchar *buffer,
gsize size,
gboolean blocking,
GCancellable *cancellable,
GError **error);
gssize g_socket_send_with_blocking (GSocket *socket,
const gchar *buffer,
gsize size,
gboolean blocking,
GCancellable *cancellable,
GError **error);
G_END_DECLS
#endif /* __G_SOCKET_H__ */