[gvfs] afp: start read loop directly on connect
- From: Christian Kellner <gicmo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] afp: start read loop directly on connect
- Date: Thu, 25 Aug 2011 19:31:02 +0000 (UTC)
commit 5c1242031634859004ce330581342c273a251d20
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Thu Aug 25 18:34:45 2011 +0200
afp: start read loop directly on connect
also change g_vfs_afp_connection_get_server_info to take a GSocketConnectable
instead of a GVfsAfpConnection
daemon/gvfsafpconnection.c | 16 +++++-----------
daemon/gvfsafpconnection.h | 6 +++---
daemon/gvfsafpserver.c | 4 ++--
3 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/daemon/gvfsafpconnection.c b/daemon/gvfsafpconnection.c
index 1551d82..96cea8e 100644
--- a/daemon/gvfsafpconnection.c
+++ b/daemon/gvfsafpconnection.c
@@ -585,7 +585,6 @@ struct _GVfsAfpConnectionPrivate
DSIHeader write_dsi_header;
/* read loop */
- gboolean read_loop_running;
DSIHeader read_dsi_header;
char *reply_buf;
gboolean free_reply_buf;
@@ -652,11 +651,6 @@ 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
@@ -1540,16 +1534,17 @@ 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 (GVfsAfpConnection *afp_connection,
+g_vfs_afp_connection_get_server_info (GSocketConnectable *addr,
GCancellable *cancellable,
GError **error)
{
- GVfsAfpConnectionPrivate *priv = afp_connection->priv;
-
GSocketClient *client;
GIOStream *conn;
gboolean res;
@@ -1557,7 +1552,7 @@ g_vfs_afp_connection_get_server_info (GVfsAfpConnection *afp_connection,
char *data;
client = g_socket_client_new ();
- conn = G_IO_STREAM (g_socket_client_connect (client, priv->addr, cancellable, error));
+ conn = G_IO_STREAM (g_socket_client_connect (client, addr, cancellable, error));
g_object_unref (client);
if (!conn)
@@ -1620,7 +1615,6 @@ 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 57badd2..d815b31 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;
-GVfsAfpConnection* g_vfs_afp_connection_new (GSocketConnectable *addr);
-
-GVfsAfpReply* g_vfs_afp_connection_get_server_info (GVfsAfpConnection *afp_connection,
+GVfsAfpReply* g_vfs_afp_connection_get_server_info (GSocketConnectable *addr,
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 c2ec489..2462281 100644
--- a/daemon/gvfsafpserver.c
+++ b/daemon/gvfsafpserver.c
@@ -731,8 +731,8 @@ get_server_info (GVfsAfpServer *afp_serv,
guint8 count;
guint i;
- reply = g_vfs_afp_connection_get_server_info (afp_serv->conn, cancellable,
- error);
+ reply = g_vfs_afp_connection_get_server_info (G_SOCKET_CONNECTABLE (afp_serv->addr),
+ cancellable, error);
if (!reply)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]