[glib] GSocket: fix connected state after async connect
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GSocket: fix connected state after async connect
- Date: Sun, 24 Jul 2011 18:55:29 +0000 (UTC)
commit aefda965f650c6713ef895a9156dd1297793f1ff
Author: Dan Winship <danw gnome org>
Date: Sun Jul 24 14:52:03 2011 -0400
GSocket: fix connected state after async connect
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.
gio/gsocket.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 070745d..f1ba5dd 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -1607,7 +1607,7 @@ g_socket_accept (GSocket *socket,
* If the connect call needs to do network I/O it will block, unless
* non-blocking I/O is enabled. Then %G_IO_ERROR_PENDING is returned
* and the user can be notified of the connection finishing by waiting
- * for the G_IO_OUT condition. The result of the connection can then be
+ * for the G_IO_OUT condition. The result of the connection must then be
* checked with g_socket_check_connect_result().
*
* Returns: %TRUE if connected, %FALSE on error.
@@ -1727,6 +1727,8 @@ g_socket_check_connect_result (GSocket *socket,
}
return FALSE;
}
+
+ socket->priv->connected = TRUE;
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]