[spice-gtk v5 17/23] file-xfer: move debug to SpiceFileTransferTask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This debug information is simple way to check that the file-transfer
is not stalled. Now that we are using the read-async functions, we can
move this debug info there and avoid accessing object internals in
channel-main.c
---
 src/channel-main.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index b1e12e3..292d1ac 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1892,19 +1892,6 @@ static void file_xfer_data_flushed_cb(GObject *source_object,
 
     file_transfer_operation_send_progress(self);
 
-    if (spice_util_get_debug()) {
-        const GTimeSpan interval = 20 * G_TIME_SPAN_SECOND;
-        gint64 now = g_get_monotonic_time();
-
-        if (interval < now - self->last_update) {
-            gchar *basename = g_file_get_basename(self->file);
-            self->last_update = now;
-            SPICE_DEBUG("transferred %.2f%% of the file %s",
-                        100.0 * self->read_bytes / self->file_size, basename);
-            g_free(basename);
-        }
-    }
-
     /* Read more data */
     spice_file_transfer_task_read_async(self, file_xfer_read_async_cb, NULL);
 }
@@ -3500,6 +3487,19 @@ static void spice_file_transfer_task_read_stream_cb(GObject *source_object,
 
     self->read_bytes += nbytes;
 
+    if (spice_util_get_debug()) {
+        const GTimeSpan interval = 20 * G_TIME_SPAN_SECOND;
+        gint64 now = g_get_monotonic_time();
+
+        if (interval < now - self->last_update) {
+            gchar *basename = g_file_get_basename(self->file);
+            self->last_update = now;
+            SPICE_DEBUG("transferred %.2f%% of the file %s",
+                        100.0 * self->read_bytes / self->file_size, basename);
+            g_free(basename);
+        }
+    }
+
     g_task_return_int(task, nbytes);
 }
 
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]