<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 18, 2014 at 4:31 PM, Pavel Grunt <span dir="ltr"><<a href="mailto:pgrunt@redhat.com" target="_blank">pgrunt@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">When a file transfer starts / finishes an information message is printed (in INFO log level).<br>
</span>Also INFO messages about the transfer progress are periodically printed.<br>
---<br>
changes since v4:<br>
  - logging is enabled when transferring more files simultaneously<br>
<br>
 gtk/channel-main.c | 42 +++++++++++++++++++++++++++++++++++++++++-<br>
 1 file changed, 41 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/gtk/channel-main.c b/gtk/channel-main.c<br>
index 1ad090f..1e0f940 100644<br>
--- a/gtk/channel-main.c<br>
+++ b/gtk/channel-main.c<br>
@@ -70,6 +70,8 @@ typedef struct SpiceFileXferTask {<br>
<span class="">     char                           buffer[FILE_XFER_CHUNK_SIZE];<br>
     uint64_t                       read_bytes;<br>
     uint64_t                       file_size;<br>
</span><span class="">+    GDateTime                      *start_time;<br>
+    GDateTime                      *last_update;<br>
</span>     GError                         *error;<br>
 } SpiceFileXferTask;<br>
<br>
@@ -1529,15 +1531,31 @@ static void main_handle_agent_disconnected(SpiceChannel *channel, SpiceMsgIn *in<br>
 static void file_xfer_task_free(SpiceFileXferTask *task)<br>
 {<br>
     SpiceMainChannelPrivate *c;<br>
-<br>
+    gchar *basename;<br>
+    double seconds;<br>
+    GDateTime *now;<br>
     g_return_if_fail(task != NULL);<br>
<br>
+    if (task->read_bytes == task->file_size) {<br>
<span class="">+        basename = g_file_get_basename(task->file);<br>
</span>+        now = g_date_time_new_now_local();<br>
+        seconds = (double) g_date_time_difference(now, task->start_time) / G_TIME_SPAN_SECOND;<br>
+        g_date_time_unref(now);<br>
<span class="">+        g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO,<br>
+              "transferred file %s of %.2f kB size in %.2f seconds (%.2f MB/s)",<br>
</span><span class="">+              basename, task->file_size / 1000.0, seconds,<br>
</span>+              (double) task->file_size / 1048576 / seconds);<br></blockquote><div><br></div><div>What does "1048576" mean? If it's not something we already have defined in glib, I'd go for a local define and a comment about the "1048576" value.<br></div><div> </div></div><div>Best Regards,</div>-- <br><div>Fabiano Fidêncio</div>
</div></div>