[gvfs] Revert "afp: start read loop directly on connect"
- From: Carl-Anton Ingmarsson <carlantoni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] Revert "afp: start read loop directly on connect"
- Date: Fri, 26 Aug 2011 10:05:49 +0000 (UTC)
commit 2ff16354d9103861f4d1d540c1ac0124b6ed7c92
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Fri Aug 26 12:01:19 2011 +0200
Revert "afp: start read loop directly on connect"
This reverts commit 5c1242031634859004ce330581342c273a251d20.
daemon/gvfsafpconnection.c | 16 +++++++++++-----
daemon/gvfsafpconnection.h | 6 +++---
daemon/gvfsafpserver.c | 4 ++--
3 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/daemon/gvfsafpconnection.c b/daemon/gvfsafpconnection.c
index 0f092cf..b725f54 100644
--- a/daemon/gvfsafpconnection.c
+++ b/daemon/gvfsafpconnection.c
@@ -585,6 +585,7 @@ struct _GVfsAfpConnectionPrivate
DSIHeader write_dsi_header;
/* read loop */
+ gboolean read_loop_running;
DSIHeader read_dsi_header;
char *reply_buf;
gboolean free_reply_buf;
@@ -651,6 +652,11 @@ run_loop (GVfsAfpConnection *afp_connection)
priv->send_loop_running = TRUE;
send_request (afp_connection);
}
+ if (!priv->read_loop_running)
+ {
+ priv->read_loop_running = TRUE;
+ read_reply (afp_connection);
+ }
}
typedef struct
@@ -1521,17 +1527,16 @@ g_vfs_afp_connection_open (GVfsAfpConnection *afp_connection,
}
g_free (reply);
- /* Start readloop */
- read_reply (afp_connection);
-
return TRUE;
}
GVfsAfpReply *
-g_vfs_afp_connection_get_server_info (GSocketConnectable *addr,
+g_vfs_afp_connection_get_server_info (GVfsAfpConnection *afp_connection,
GCancellable *cancellable,
GError **error)
{
+ GVfsAfpConnectionPrivate *priv = afp_connection->priv;
+
GSocketClient *client;
GIOStream *conn;
gboolean res;
@@ -1539,7 +1544,7 @@ g_vfs_afp_connection_get_server_info (GSocketConnectable *addr,
char *data;
client = g_socket_client_new ();
- conn = G_IO_STREAM (g_socket_client_connect (client, addr, cancellable, error));
+ conn = G_IO_STREAM (g_socket_client_connect (client, priv->addr, cancellable, error));
g_object_unref (client);
if (!conn)
@@ -1602,6 +1607,7 @@ g_vfs_afp_connection_init (GVfsAfpConnection *afp_connection)
NULL, (GDestroyNotify)free_request_data);
priv->send_loop_running = FALSE;
+ priv->read_loop_running = FALSE;
}
static void
diff --git a/daemon/gvfsafpconnection.h b/daemon/gvfsafpconnection.h
index 90ce765..f5cde13 100644
--- a/daemon/gvfsafpconnection.h
+++ b/daemon/gvfsafpconnection.h
@@ -386,12 +386,12 @@ struct _GVfsAfpConnection
GType g_vfs_afp_connection_get_type (void) G_GNUC_CONST;
-GVfsAfpReply* g_vfs_afp_connection_get_server_info (GSocketConnectable *addr,
+GVfsAfpConnection* g_vfs_afp_connection_new (GSocketConnectable *addr);
+
+GVfsAfpReply* g_vfs_afp_connection_get_server_info (GVfsAfpConnection *afp_connection,
GCancellable *cancellable,
GError **error);
-GVfsAfpConnection* g_vfs_afp_connection_new (GSocketConnectable *addr);
-
gboolean g_vfs_afp_connection_open (GVfsAfpConnection *afp_connection,
GCancellable *cancellable,
GError **error);
diff --git a/daemon/gvfsafpserver.c b/daemon/gvfsafpserver.c
index ce0d5b7..ca1ff20 100644
--- a/daemon/gvfsafpserver.c
+++ b/daemon/gvfsafpserver.c
@@ -757,8 +757,8 @@ get_server_info (GVfsAfpServer *afp_serv,
guint8 count;
guint i;
- reply = g_vfs_afp_connection_get_server_info (G_SOCKET_CONNECTABLE (afp_serv->addr),
- cancellable, error);
+ reply = g_vfs_afp_connection_get_server_info (afp_serv->conn, cancellable,
+ error);
if (!reply)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]