summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2011-08-25 18:34:45 +0200
committerChristian Kellner <gicmo@gnome.org>2011-08-25 21:19:57 +0200
commit5c1242031634859004ce330581342c273a251d20 (patch)
tree6d6b0876dcb9e7a7fb6dc60df677b74e930120bd /daemon
parentecc1730d3bfdc11fa07f15893267a7ea054328f1 (diff)
downloadgvfs-5c1242031634859004ce330581342c273a251d20.tar.gz
afp: start read loop directly on connect
also change g_vfs_afp_connection_get_server_info to take a GSocketConnectable instead of a GVfsAfpConnection
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gvfsafpconnection.c16
-rw-r--r--daemon/gvfsafpconnection.h6
-rw-r--r--daemon/gvfsafpserver.c4
3 files changed, 10 insertions, 16 deletions
diff --git a/daemon/gvfsafpconnection.c b/daemon/gvfsafpconnection.c
index 1551d82e..96cea8e1 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 57badd2b..d815b31b 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 c2ec489f..2462281a 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;